subtracting points on waves
epiphenom
function go()
wave wave2
wave wave1
wave val
make /O/N = (numpnts(wave2)) val
variable x = 1
variable p = 0
print "val has ", numpnts(wave2)
do
val[p] = wave2[x] - wave1[p]
// if (x >= (numpnts(wave2)) || p >= (numpnts(wave1) -1))
if (x == numpnts(wave2) || p == (numpnts(wave1) -1))
val[numpnts(wave2)] = NaN
else
break
endif
x+=1
p+=1
while (1)
end
wave wave2
wave wave1
wave val
make /O/N = (numpnts(wave2)) val
variable x = 1
variable p = 0
print "val has ", numpnts(wave2)
do
val[p] = wave2[x] - wave1[p]
// if (x >= (numpnts(wave2)) || p >= (numpnts(wave1) -1))
if (x == numpnts(wave2) || p == (numpnts(wave1) -1))
val[numpnts(wave2)] = NaN
else
break
endif
x+=1
p+=1
while (1)
end
wave wave2
wave wave1
make /O/N = (numpnts(wave2)-1) val // one point shorter
val = wave2[p] - wave1[p+1]
//if you really want an additional point with 'NaN', uncomment the next two lines
//redimension/n=(numpnts(val)+1) val
//val[numpnts(val)-1]=NaN
end
You could also execute the middle two lines on the command line without needing a function for this operation. I do not know how experienced you are in Igor programming, but it seems to me like some important concepts of wave assignment operations are still somewhat unclear. I recommend you to read the help chapter about this by executing
DisplayHelpTopic "Waveform Arithmetic and Assignment"
November 27, 2014 at 05:49 pm - Permalink
November 27, 2014 at 06:52 pm - Permalink