How to go through all the data folder in the data browser?

Hi,

I am treating my data from one instrument now. But I have some coding problems.

Here is what I want to do

-----

  1. Go check all the folder in the data browser to see if any folder has a wave with a specific length.
  2. If there is a wave with that specific length, I treat that wave (this step I have already written a function to do).
  3. If there is no wave with that specific length, I jump to the next folder or previous foder.

-----

 

Basically, I have to go through all the folders in the data browser and go into that folder to check the existence of that wave. I know how to scan folder on the disk with NewPath and indexeddir functions, but when I tried to do the similar things on my data browser, it failed.

 

Please help me with this? If you already have the code doing this sort of thing, please attach it here. If you have some good ideas on how to achieve this, please also enlighten me.

 

Thanks!

Maybe the following will help you recursively search the data structure of the experiment:

DisplayHelpTopic "CountObjectsDFR"
DisplayHelpTopic "GetIndexedObjNameDFR"

 

Here's a function I wrote to graph waves called "ThingName" from a set of folders. You should be able to use it as a template for what you're trying to do.

Function PlotAllOfSomething(ThingName, skipfolders, nfolders)
    String ThingName
    Variable skipfolders, nfolders //Use nfolders=-1 to plot all
   
    String StartDF=GetDataFolder(1)
    Variable j=0
   
    Display
   
    If(nfolders==-1)
        nfolders=CountObjects(StartDF, 4)
    EndIf

    For(j=skipfolders;j<nfolders;j+=1)
        String FolderName=GetIndexedObjName(StartDF, 4, j)
        SetDataFolder FolderName       
        Wave Thing=$(ThingName)
       
        AppendToGraph Thing    

        SetDataFolder StartDF
    EndFor
End //PlotAllOfSomething

 

There is an example of recursively examining data folders in the Igor reference help for the WaveRefIndexedDFR function. The example is called DemoWaveRefIndexedDFR.