Basic Help With Coding

Hi All,

I have the following problem. I have a many subfolders (nearly 300) that are in the root directory. Each of these folders contains the same number of waves. These waves have the same naming scheme. One of these waves contains the results of a Gaussian Curvefit; therefore, that wave has 4 elements. I need a function (or code) that can drill into each subfolder and extract the 1st, 2nd, 3rd and 4th elements(essentially fit coefficients) of this wave, and then force each element to be appended to the end of one of four “superwaves” located in the root directory. More specifically, the first element(coefficient) should be appended to a wave (in root) called Baselines. The second element should be appended to a wave named Amplitudes . The third element should be appended to a wave called PeakCenters. The fourth element should be appended to a wave named Widths.

Thanks very much for the help.

q4X-ray
Here is something to get you started. The use of DFREF requires Igor Pro 6.1.
Function Test()
    String baseDF = "root:"
    Variable numDataFolders = CountObjects(baseDF, 4)
    Make/O/N=(numDataFolders) out
   
    Variable i
    for(i=0; i<numDataFolders; i+=1)
        String dfName = GetIndexedObjName(baseDF, 4, i)
        DFREF dfr = $dfName
        Wave W_coef = dfr:W_coef
        out[i] = w_coef[0] 
    endfor
End

Hi,

Thanks. I see how this code should work to give me what I need. Thanks again. I am trying to implement this. I had a little trouble. The code compiles, but I am getting an error.. WAVE error: "WAVE reference to "W_coef" failed." I understand PARTIALLY. I think this is a run-time error because this wave exist (in Igor's mind). The part I don't understand is why Igor does not know that wave W_coef exists when it is clearly in each subfolder of root:.

A bit more help would be greatly appreciated. I will go back and read your section on wave references... I will want to get on top of this idea.

Thanks, q4X-ray