Procedure to divide waves like with wave arithmetic panel

Hi everyone,

I'm very new to Igor and I'm trying to use macro to automatise something I'm doing.

What I am doing is : I have 4 waves to display 2 curves in a graph. I use crtl+I to place a cursor on each curve. Then I go to Analysis => Wave arithmetic Panel.
In "Wave arithmetic" I select "A/B", "X values from A and B wave" and I got a new wave. I'm using this division because my waves don't have the same lenght / sampling rate, and this work just fine.

So this is what I'm trying to do with a macro. So far I have :

<br />
Display wave0 vs wave1; AppendToGraph wave2 vs wave3<br />
•cursor A wave0 1<br />
•cursor B wave2 1<br />
ModifyGraph rgb(wave0)=(0,0,65535)<br />


But I'm stuck here. How can I say to Igor : "now I would divide this wave by the other"? And I want to do the same thing than the arithmetic panel, a "graphic division" that works even with different lengths / sampling rates for the waves.
When I'm doing it manually Igor say this :

<br />
  ユDivide root:wave0 / root:wave2<br />
  ユWave Arithmetic:<br />
  	AppendToGraph   NewWave  vs  root:NewWave_X<br />
  	ModifyGraph rgb(  WAr_1  )=(0,0,65535)<br />


But the "ユ" got me a synthax error and without it I got another error "expected wave name".


So this is my problem, I don't know if I'm searching in the right way? If anyone have a solution / suggestion that would help me alot.
Thanks
I've attached a procedure that does something similar. It may help give you a head start. In my case I subtract rather than divide. The code works for mismatched wavelengths if the data are properly scaled as waveform (or for equal sized data that share a common x-values).
ScaleSub.ipf
I have created a function that does a credible job of arithmetic on mismatched XY pairs of waves. I have posted it as a code snippet: http://www.igorexchange.com/node/8273

It determines the overlap in X range of the two input X waves and then interpolates a Y value from each input Y wave for each of the input X values that fall within the common X range. So you get a value in the output XY pair for each X input from each input XY pair. It makes no attempt to eliminate duplicate values. If you have identical X values, you should just use plain old Igor-style wave arithmetic.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com