GetWavesDataFolder (can't get it to work?)

Hi all,
I'm attempting to make my program work with data folders, since I have a compilation experiment with lots of folders of data. I'm writing data from the topmost graph to a text file in a specific manner, but the problem I'm having is that many of the graphs have data from different folders.

First question. Does "GetWavesDataFolder" search for a particular wave name throughout all of the data folders in root? Or does it only look in the current data folder... although that'd seem useless.

Second question. Why won't it work?

I have a wave nested in the following path. root:Folder1:Folder2:wave1

When I'm in root: or root:Folder1 and try the following

print getwavesdatafolder('wave1',2)


or any other variation of quotes around wave1, I get "expected wave name." I realize that getwavesdatafolderdfr is now preferred, but I'd still like to know why this doesn't work.

How would I do this properly?
If your print statement is on Igor's command line, then it will fail because Igor can't resolve the name to a wave it can find in the current data folder. GetWavesDataFolder() is more useful in a function like this:
Function test(w)
    Wave w
   
    print GetWavesDataFolder(w, 2)
end

Here, the wave reference named "w" can point to any wave anywhere. But on the command line, the name "wave1" is a name, and to connect that to a wave requires looking up the wave that has that name. An unqualified wave name (that is, one that doesn't have a data folder path) is looked up in the current data folder.

So, indeed, GetWavesDataFolder() is not very useful on the command line. It was intended for use in a user function where it is much more useful.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
For command line testing try this:

print GetWavesDataFolder(TraceNameToWaveRef("Graph0", "w" ), 1)

Where "Graph0" and "w" should be changed to your graph and trace names.
Thanks all. Funny thing is, looking through my history, I just asked this exact question a few weeks ago!

Tracenametoref (or whatever it is) works as described.