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 graph String traceName // e.g., "wave0" or "wave0#1"
Wave/Z w = TraceNameToWaveRef(graphName, traceName) if(!WaveExists(w)) return $""// NULL DFREF endif
DFREF dfr = GetWavesDataFolderDFR(w) return dfr End
Function/S GetTracesDFStr(graphName, traceName, mode) String graphName // "" for top graph String traceName // e.g., "wave0" or "wave0#1" Variable mode // 0: Get data folder name; 1: Get data folder path
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 graph String traceName // e.g., "wave0" or "wave0#1"
Wave/Z w = TraceNameToWaveRef(graphName, traceName) if(!WaveExists(w)) return $""// NULL DFREF endif
DFREF dfr = GetWavesDataFolderDFR(w) return dfr End
Function/S GetTracesDFStr(graphName, traceName, mode) String graphName // "" for top graph String traceName // e.g., "wave0" or "wave0#1" Variable mode // 0: Get data folder name; 1: Get data folder path
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.
String graphName // "" for top graph
String traceName // e.g., "wave0" or "wave0#1"
Wave/Z w = TraceNameToWaveRef(graphName, traceName)
if (!WaveExists(w))
return $"" // NULL DFREF
endif
DFREF dfr = GetWavesDataFolderDFR(w)
return dfr
End
Function/S GetTracesDFStr(graphName, traceName, mode)
String graphName // "" for top graph
String 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 ""
endif
String df = GetDataFolder(mode, dfr)
return df
End
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