How to align traces in time, or how to transform the x-component of a wave

I have electrophysiology data in which there are events that begin at different times, and I would like to align the events so that I can view them as if they happened at the same time. For more background - I am recording evoked currents from neurons, and have about 10 waves, one from each cell I sampled. The electrical stimulation always happens 150ms from the beginning of the recording, but due to biological variation, the currents reach maximum value anywhere between 5 and 10 seconds after the stimulation. I would like to align my traces in the x-dimension by the location of the current peak, so that I can view all of them and compare the kinetics of the currents with the traces overlaid.

Here is what I have so far:

Function xAlign(wname)
wave wname
WaveStats/Q/R=(1520,1640) wname
wname-=(V_minloc)
return 0
end

Currently the code subtracts the x location of the peak from the y-values of my wave. I would like to subtract the x-location of the peak from the x-values of my wave, so that the peak of the waves are centered on x=0. So instead of wname in the 4th line, I would like to specify the x-values of wname.

Thank you for reading!
Do you want to be able to simply view them in a graph, or do you want to perform further calculations? If you just want to look at them, I would recommend displaying and offsetting the trace. If you want to do further calculations, you can change x scaling such that 1st point is -(V_minloc).
I Agree and would like to mention the setscale command to to this. Have a look at its documentation:
displayhelptopic "setscale"
HJ
You might also want to check out the Wave Arithmetic package- it includes a capability to align points on traces that are marked by the graph cursors. You should first look at the demo experiment for the package: File->Example Experiments->Analysis->Wave Arithmetic.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com