Sometimes, I want to curvefit data that comes from multiple waves. My solution has been to manually copy and paste each wave into a new, single wave for my x and y datasets, respectively. The problem that I have with this is that that while my plot looks pretty, I cannot curve fit a range of data. This is because the "merged" data is not numerically sequential. I believe that I can use "sort" to arrange one of the waves in a sequential manner, but if I did the same thing to the other axis' data, the data points will no longer properly match up.
So my question is, how can I sort data a la Excel? In particular, I am thinking of the Excel functionality to sort a column in ascending or descending order, and to expand that selection to include other columns. This sorts x-y pairs of data according to only one of the columns, preserving the pairs. Any ideas?
Check out the sort operation. If you have two waves, xwave and ywave you would issue this command to sort them, using xwave as a key:
//syntax of sort is: Sort [/A/C/R] sortKeyWaves, sortedWaveName [, sortedWaveName ]... Sort xwave,xwave,ywave //now do a reverse sort (largest to smallest) Sort/R xwave,xwave,ywave
Thank you both, that works wonderfully well! The concept of a "key" is new to me, as I have not had a need to sort wavedata before. On a slightly related note, is there a command to merge waves simply, i.e. take wave1 and wave2 and make them into wave3, which consists of the values of wave1 followed by the values of wave3? Or is this best done by writing a function? What if I wanted to interleave wave1 and wave2?
Thank you both, that works wonderfully well! The concept of a "key" is new to me, as I have not had a need to sort wavedata before. On a slightly related note, is there a command to merge waves simply, i.e. take wave1 and wave2 and make them into wave3, which consists of the values of wave1 followed by the values of wave3? Or is this best done by writing a function? What if I wanted to interleave wave1 and wave2?
Again, thank you very much. I'm not so much an Igor noobie as much as someone who hasn't explored the full power and functionality of the program over the last 10 years. I only wish I'd started sooner.
sort
operation. If you have two waves, xwave and ywave you would issue this command to sort them, using xwave as a key:Sort xwave,xwave,ywave
//now do a reverse sort (largest to smallest)
Sort/R xwave,xwave,ywave
July 8, 2008 at 03:44 pm - Permalink
Duplicate xdata, ydata1
Duplicate xdata, ydata2; ydata2 += 1
Display ydata1 vs xdata
Append/R/T ydata2 vs xdata
SetAxis left 0,6
SetAxis right 0,6
ModifyGraph rgb(ydata2)=(1,12815,52428)
Edit xdata, ydata1, ydata2
Sort xdata ydata1,ydata2,xdata // Sort ydata1,ydata2,xdata using xdata as key
July 8, 2008 at 03:52 pm - Permalink
July 9, 2008 at 01:42 pm - Permalink
Check out the Concatenate operation.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
July 9, 2008 at 05:39 pm - Permalink
July 10, 2008 at 08:40 am - Permalink
June 10, 2013 at 11:21 am - Permalink