I'm a bit confused with the usage of x2pnt and its relationship with FindValue.
In the past I have been able to use x2pnt to delimit a region of a wave to be fitted by an equation and all worked good.
Today, when attempting to use x2pnt again in another procedure I still cannot understand the output I was getting.
For example, for a random wave with n number of points, every time I tried to print x2pnt(wavename, xvalue), instead of printing out the point/position of the xvalue on the wave, I just got xvalue itself. I ended up going for FindValues which worked fine.
What am I missing here? Is there any limitation in the use of x2pnt that I am not considering? the documentation seems quite trivial about it.
What is the difference between the two functions in terms of usage?
Thanks in advance.
PS: Incidentally, pnt2x was also printing the point number rather than the xvalue.
can you show your "random wave" or how you create the wave?
Maybe the delta value is set to 1 by accident? Are you using an x-wave?
print dimdelta(wavename, 0)
FindValue searches the values assigned to each data point of the wave, x2pnt searches the x-scaling of the wave set with SetScale, not the actual values in the wave.
Ah OK, now I spot the mistake!
Many thanks to the input guys!!
Could you share the basic concept of your solution to others with a similar issue?
Essentially, I followed your input. I did not realize that x2pnt would work only on xwaves. The DisplayHelpTopic "x2pnt" treats it very trivially and the lack of an error message also did not help. My former use of the function was incidentally on waveforms, so I did not encounter this problem back then, and was now a bit confused. Many thanks again for the help.
The documentation for x2pnt links to "The Waveform Model of Data". Read that section carefully about three times. It is important.
Also, the guided tour section "Waves - The Key Igor Concept" covers much of the same material. If you have not done the guided tour, choose Help->Getting Started. It is essential for understanding Igor.
Back to top