Find a value in wave
simcacl
I have a wave like
wave0=(1.2, 13,20,40)
I would like to search a given value in wave0, so I wrote something similar to:
name="wave0"
i=-1
do
i=+1
wave wname=$name
if (wname[i]==value)
print "yes"
endif
while (i<4)
it works fine with integer number but it can't find number with digits. What is it going wrong?
Thanks
variable vTolerance = 0.001 //set your desired tolerance here
i=-1
do
i=+1
wave wname=$name
if (value - vTolerance < wname[i] < value + vTolerance)
print "yes"
endif
while (i<4)
You could also see if built in functions, such as FindLevel, will help.
October 12, 2015 at 05:15 am - Permalink
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
October 12, 2015 at 08:23 am - Permalink
I had similar problem with my procedure unable to compare variables with decimal points. I used the Function
BinarySearch(waveName, val)
Also
FindValue [/I=iValue /S=start /T=tolerance /U=uValue /V=rValue /Z] srcWave
April 23, 2019 at 09:50 am - Permalink