Retrieve x-value from Scale
emmegamma
Hi,
I have a set of scaled waves, and now I need to divide each point ("Y point", to call it somehow) by its corresponding X-point, to store the result in a new wave and make further operations.
I guess I'd use a for cycle, and tell Igor to store Y[i]/X[i] in NewWave[i] at each i point, but I don't know how to access the X-values in any way (be it by accessing them "directly", or by using the starting index of the scale and the delta to calculate X, whichever is feasible).
Is there a way to do so?
Thank you, best
Hi,
I think the function you need is:
pnt2x(waveName, pointNum )
The pnt2x function returns the X value of the named wave at the point pointNum. The point number is truncated to an integer before use.
for an original wave, baseWave,
Duplicate baseWave, newWave
newWave [] =baseWave[p]/pnt2x(baseWave,p)
Andy
June 9, 2022 at 10:46 am - Permalink
Oh that's right, I even had used that in the past, I had completely forgotten!
Well, thank you
June 9, 2022 at 10:59 am - Permalink
You should be able to just do newWave[]=baseWave[p]/x since x is a valid counter as long as newWave and baseWave have the same x scaling
June 9, 2022 at 12:48 pm - Permalink
I can in fact, that's an even simpler writing!
Actually, I had just newWave[] = baseWave/x , and it seems to be enough (no for cycle needed, even, and I suspect the [] are superfluous)
June 10, 2022 at 09:01 am - Permalink
Yes, the [] are not needed in this case, since you do not specify a range. Just note that, as Ole has mentioned, you need to have the same scaling for both waves, since 'x' originates from newWave. But this can always be simply achieved by duplication.
June 10, 2022 at 05:40 pm - Permalink