Sorting wave based on scaled x values
Pablo4429
I was wondering if there is a way to sort a wave based on the scaled x values. I have to concatenate some waves together but they are not in the correct order but each will have a scaling that could be used to sort the values. I can't figure out the command that can accomplish this, anybody have any suggestions?
Best,
Paul
String wlist
Variable nwaves = ItemsInList(wlist)
Make/FREE/N=(nwaves) xlist
xlist = DimOffset($StringFromList(p, wlist), 0)
Make/N=(nwaves)/FREE xindices
makeIndex xlist, xindices
String newlist = ""
Variable i
for (i = 0; i < nwaves; i += 1)
newlist += StringFromList(xindices[i], wlist)+";"
endfor
return newlist
end
Example:
•setscale/P x 0,1,w1
•setscale/P x 1,1,w3
•setscale/P x 2,1,w2
•print sortWavesByXScale(WaveList("w*", ";", ""))
w1;w3;w2;
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
December 11, 2014 at 01:55 pm - Permalink