Sorting two waves simultaneously, a la Excel

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

I'm not sure I understand the question. However, Igor's sort operation can sort any number of waves using a single sort key. Here is an example:

Make xdata = {1,3,2,5,4}
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


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?
patarroyo wrote:
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?


Check out the Concatenate operation.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
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.