Trouble using dfref's that are stored in a dfref wave

I made a dfref wave in the root directory ( cd root; make/DF/N=1 refWave = { root:NameOFMyFolder } ; )

I try to use  ( SetDataFolder root:refWave[0] ) and get "expected ';' or <cr>"  with the left square bracket now highlighted in the command window.

I try inserting a point to the refWave [after the 0th index] in case for some random reason waves with one entry are not to be indexed.

So it seems that SetDataFolder sees root:refWave and says "ok, I need to find the folder root:refWave ... but this command is not ended with carriage return or ; ... so let's send an error"

I also cannot seem to print the 10-digit number which corresponds to the dfref ( print root:refWave[0] )

Any help on this issue is much appreciated.

I'm pretty sure you can not use datafolder reference waves on the command line.

In a function like


Function Dostuff()

    NewDataFolder/O/S myfolder
    Make/DF/O dfrs = {GetDataFolderDFR()}
    SetdataFolder root:
    print GetDataFolder(1)
    DFREF dfr = dfrs[0]
    SetdataFolder dfr
    print GetDataFolder(1)

I get




which looks right.


You wrote that the DF wave item is "root:NameOFMyFolder" and then tried SetDataFolder root:refWave[0] , which to my mind, expands to "root:root:NameOFMyFolder."  This is surely going to raise and error.

Thank you all. Indeed, I do not see a way to use DF waves in command line or to pass a dfref between functions using DF waves in root: folder in a very direct way, but the workaround works fine.

In addition to the workaround posted above, I use something like:

Function useRef( dfref needsRef )
    SetDataFolder( needsRef ) ;

Function giveRef( int index )
//This is the one I call from the command line and so can't give it a dfref directly
    wave/DF refWave = root:NameOfMyRefWave ;
    dfref   theRef  = refWave[index] ;
    useRef( theRef ) ;


> or to pass a dfref between functions using DF waves in root: folder in a very direct way

That is possible with something like

Function Example()

    NewDataFolder/O/S myfolder
    Make/DF/O dfrs = {GetDataFolderDFR()}

Function DoSomething(WAVE/DF wv)

    DFREF dfr = wv[0]
    print GetDataFolder(1, dfr)