Generating New Graph from Top Graph Waves in script
Fri, 12/14/2018 - 08:46 am
I have created a script to take the waves from my top graph and generate new waves that have been differentiated and smoothed. This part of the script works great, but to save time during my data workup, I have been trying to get the script to generate a new graph with just the new waves. But since my script uses a 'For' loop, every attempt to have it generate a new graph causes the script to recognize it as the new top graph, which doesn't contain data. Thus the script ends because there is no more data that it recognizes. This may just be an issue with order of operations in the commands, but I can't seem to figure out how to fix it. Any thoughts?
string list = tracenamelist("",";", 1) //get list of normal traces on topmost graph
for (i=0; i<itemsinlist(list); i+=1)
wave ywave = TraceNametoWaveRef("", stringfromlist(i, list, ";")) //trace i from top most graph
wave xwave = XwaveRefFromTrace("", stringfromlist(i, list, ";")) //x wave associated with trace i
String yname = NameofWave(ywave) //get the name of the y wave
String dest_wave = yname + "_DIF" // add _DIF to name to distinguish from source
String dest_wave2 = dest_wave + "_smth" // add _smth to name to distinguish from source
Differentiate ywave/X=xwave/D=$Dest_Wave;DelayUpdate //use string Dest_Wave to name the destination wave based on the y-wave name.
Duplicate/O $Dest_Wave, $Dest_Wave2
Smooth/EVEN/B 20, $Dest_Wave2;DelayUpdate
AppendtoGraph $Dest_Wave2 vs xwave