![](/profiles/wavemetrics/themes/wavemetrics/logo.png)
Setting a Data Folder Path in a user-defined function
![](/sites/default/files/styles/thumbnail/public/default_images/Artboard%201_1.png?itok=jeHOCIXy)
N.Duc
I am trying to use the SetDataFolder command in a userdefined function, so that I may get to the waves I create with it from other functions.
However, I get the following error message :
Function RelativeKayserCalc(Rel,X0) SetDataFolder root:Data:Load Variable Rel,Xpnts,i=0 wave X0 wave XK Xpnts = numpnts(X0) do XK[i]=CalcStokes(X0[i],Rel) i=i+1 while(i<Xpnts) End
This function runs after being called by a top level routine that creates the new data folder paths.
Is there a way around this problem?
I have the impression there should be an easy solution, but I've tried to no avail.
Thanks,
Nicolas
June 27, 2013 at 03:14 am - Permalink
June 27, 2013 at 06:13 am - Permalink
Thanks a lot for helping me out.
I had a feeling it was going to be an easy answer :).
I still have a little work ahead of me!
Nicolas
June 27, 2013 at 06:27 am - Permalink
For this specific short case, I would just eliminate the call to RelativeKayserCalc(...) in the main function and replace it directly by its code. You may have other things going on in the entire function though that make sense for it to be a full function.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
June 27, 2013 at 10:14 am - Permalink
The /SDFR flag is supported only in WAVE, NVAR and SVAR statements.
The dfr: syntax shown above is supported wherever Igor expects a wave or global variable. This includes WAVE, NVAR and SVAR statements and in any command that uses a wave, for example, in a Display command.
Often dfr will be passed as a parameter to identify the data folder in which the function is to work.
June 27, 2013 at 11:29 am - Permalink
Ah yes ... that is cleaner for sure.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
June 27, 2013 at 02:01 pm - Permalink