looping operation multiple data folders

I am trying to loop over data folders and do operations within each folders, ( so something like 2 for loops maybe? )

In attached image , folder "tests" contains number of folders "NearbyR_xy" each folder contains 2 waves. I want to do operation on each wave within folder ( e.g. "NearbyR0xy" )  and want to repeat it for the rest of the folders. What is the easiest way doing this?

The way I was thinking doing it , first defining a "for loop" for  each folder "NearbyR..." then another "for loop" to do operation within each wave (for example making waves and adding them to existing waves or some simple operation that would involve second looping)

Thank you,

here is how folders and files look like

A snippet that I use having already made the data folders (within a folder called data) looks like this:

// this function goes into each datafolder and run some code in there
Function DoStuffInFolders()
    SetDataFolder root:data:    // relies on earlier load
    DFREF dfr = GetDataFolderDFR()
    String folderName
    Variable numDataFolders = CountObjectsDFR(dfr, 4)
   
    Variable i
       
    for(i = 0; i < numDataFolders; i += 1)
        folderName = GetIndexedObjNameDFR(dfr, 4, i)
        SetDataFolder ":'" + folderName + "':"
        // you can write some code here or use another function to do what you want
        DoStuff()
        SetDataFolder root:data:
    endfor
    SetDataFolder root:
End

Hope it helps

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More