How to extract the x portion of a wave

Igor's wave model, i.e. an array with a built-in scale, is excellent. However, when collaborating with non-Igor users I find myself sometimes wanting to use a wave's "x" component (wave.x as opposed to the data component wave.d) and turn it into its own wave. This comes up when plotting data imported from others on the same plot as my Igor-processed data.

I use the few steps below to do this (duplicate my wave, set its left end, and use the wave's delta to calculate the remaining values). This works, but I am curious whether there is a function that does this in one step. I tried:

freezeVid_t = freezeVid.x

But it didn't work.

Here is an example of how I do this now:

    duplicate /O freezeVid, freezeVid_t
    freezeVid_t[0] = pnt2x(freezeVid, 0)
    variable /g timeStep
    timeStep = deltaX(freezeVid)
    freezeVid_t = freezeVid_t[0] + timeStep * p

 

wv = x

This writes the x value of each point of the wave wv into it. For the details see

Displayhelptopic "Indexing and Subranges"

In general you can convert easily between index and x-scale with ScaleToIndex and IndexToScale.

And just to make it really explicit, this will generate a new wave containing X values from a Y wave with X scaling set:

Duplicate wave0, wave0x
wave0x = x

 

I just wondered, what you mean by ...

Quote:

This comes up when plotting data imported from others on the same plot as my Igor-processed data.

You can plot scaled waves and xy-wave pairs together in the same plot without problems, so that might not what you mean? Also, if you know the x-values of the imported data you could assign a x-scaling to the imported data instead (even automatically if you like). This would make working with imported data much easier and with less clutter. For example, I always convert data to scaled waves (even non uniform ones), because losing track of all the x-waves is waaay to easy. I do not know what your data looks like or what for problems you face, so I cannot give you any specific advice here.

Thank you Thomas and John! Very straightforward. In fact, I should have known: I have used the function p before to create a wave of 1, 2, 3, 4... It didn't occur to me that x would play an analogous role but for the wave's scaling.

Chozo: I am referring to situations where a colleague provides me with signal and its associated time series to plot in Igor alongside the data I already have in Igor. Yes, I realize I can plot a wave with scaling on the same plot as a y vs x trace. But part of the work involves shifting the relative timing of the two signals to figure out their time offset. The data is then exported to my colleague who needs a shifted time series to go along with my signal. I've found it easiest to keep things straight in my head if I use explicit time series.

Thanks again to all! Pietro