It's strange that the command TraceInfo(graphNameStr, yWaveNameStr, instance ) doesn't return the YWAVE DataFolder but XWAVEDataFolder.
I think that's because you can get the y wave and its data folder through other means (see the first function below), but I agree, it would seem more complete to include this information in the result from TraceInfo.
Here are functions that should work for you.
Function/DF GetTracesDFR(graphName, traceName)String graphName // "" for top graphString traceName // e.g., "wave0" or "wave0#1"Wave/Z w = TraceNameToWaveRef(graphName, traceName)if(!WaveExists(w))return $""// NULL DFREFendif
DFREF dfr = GetWavesDataFolderDFR(w)return dfr
EndFunction/S GetTracesDFStr(graphName, traceName, mode)String graphName // "" for top graphString traceName // e.g., "wave0" or "wave0#1"Variable mode // 0: Get data folder name; 1: Get data folder path
DFREF dfr = GetTracesDFR(graphName, traceName)if(DataFolderRefStatus(dfr) == 0)return""endifString df = GetDataFolder(mode, dfr)return df
End
For information about trace names like "wave0#1", execute this:
It's strange that the command TraceInfo(graphNameStr, yWaveNameStr, instance ) doesn't return the YWAVE DataFolder but XWAVEDataFolder.
I think that's because you can get the y wave and its data folder through other means (see the first function below), but I agree, it would seem more complete to include this information in the result from TraceInfo.
Here are functions that should work for you.
Function/DF GetTracesDFR(graphName, traceName)String graphName // "" for top graphString traceName // e.g., "wave0" or "wave0#1"Wave/Z w = TraceNameToWaveRef(graphName, traceName)if(!WaveExists(w))return $""// NULL DFREFendif
DFREF dfr = GetWavesDataFolderDFR(w)return dfr
EndFunction/S GetTracesDFStr(graphName, traceName, mode)String graphName // "" for top graphString traceName // e.g., "wave0" or "wave0#1"Variable mode // 0: Get data folder name; 1: Get data folder path
DFREF dfr = GetTracesDFR(graphName, traceName)if(DataFolderRefStatus(dfr) == 0)return""endifString df = GetDataFolder(mode, dfr)return df
End
For information about trace names like "wave0#1", execute this:
I think that's because you can get the y wave and its data folder through other means (see the first function below), but I agree, it would seem more complete to include this information in the result from TraceInfo.
Here are functions that should work for you.
For information about trace names like "wave0#1", execute this:
April 1, 2011 at 08:00 pm - Permalink
That's very useful. Thank you very much.
April 1, 2011 at 10:43 pm - Permalink