dfr2str
| nplumb | April 9, 2010 - 11:52 | ||
|---|---|---|---|
|
It'd be nice to have a "dfr2str" command to switch back from DFREF to string. You could think of it as GetWavesDataFolder, but for DFREF's. In my view, this would be handy for printing out data folder paths in the command line or in message prompts. Presently users can implement something along the lines of the following: Function dfr2str(dfr) DFREF dfr String dfstr DFREF initialFolder = GetDataFolderDFR() SetDataFolder dfr dfstr = GetDataFolder(1) SetDataFolder initialFolder return dfstr End However, this is a sort of silly way to perform a task that is probably worthy of being built-in to Igor. Also, it'd be nice if it supported various output modes (similar to GetDataFolder). I'm conflicted about how it should handle invalid DFREF's; perhaps there should be yet another (optional?) parameter for permitting an invalid ref -- otherwise, by default, the function returns a null string. Actually, it might not be a bad idea to replicate this sort of function for S/NVARS. Come to think of it, I could envision one all-encompassing function like "GlobalRef2str" that will take any global reference as input and spit out a string. Maybe this is a better approach. Nick |
|||

Joined: 2007-06-21
Location: United States
As of Igor Pro 6.1, the GetDataFolder function takes an optional dfr parameter. I think it does what you want.
Joined: 2009-02-12
Location: Switzerland
Ah - I never noticed the change. Thanks!