RemoveFromGraph Tracenamelist
hegedus
I am creating a button to clear the active window of all the traces
Function RemoveAll(ctrlName) : ButtonControl
String ctrlName
String Alltraces
alltraces = removeending(tracenamelist("master",",",1))//remove trailing comma
print all traces //used for debugging
removefromGraph/w=Master $alltraces
End
String ctrlName
String Alltraces
alltraces = removeending(tracenamelist("master",",",1))//remove trailing comma
print all traces //used for debugging
removefromGraph/w=Master $alltraces
End
This returns an error that the traces are not on the graph. However if I go to the command line and take the printed string as the tracenamelist to removefromgraph, it works fine. How can tracenamelist return a trace name not on graph?
You need to write a loop that extracts one name from the list and removes that one trace, then loops around to do the next.
Watch out for a gotcha- if you have traces with the same name so that you get trace instance names ("MyWave", "MyWave#1", etc.) then removing the first one ("MyWave") changes the name of the second one from "MyWave#1" to "MyWave". The solution is iterate over the list backwards, from the last in the list to the first.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
February 23, 2015 at 10:16 am - Permalink
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
February 25, 2015 at 07:39 pm - Permalink