Infimum
igorman
I was just wondering if there is a function or so in Igor that can be used to calculate the infimum of a set of numbers given a particular value.
For example in the following code, Im trying to find the numbers in my wave that are < 1 and > 9. After having found the set of numbers for each category, I was hoping to find the infimum from that, and I was wondering if there is a particular function for that.
The two for loops pretty much define the sets of numbers. For the first for loop, i want to find the infimum of its set of numbers < 1, and for the second for loop I want to do the same with set of numbers > 9.
Any tips or suggestions?
Function Auxiliary(inwave1)
Wave inwave1
variable crossing0
variable crossing 1
crossing0 = 1
crossing1 = 9
//...(I will skip to the for loops)
for (i=0;i<numPoints;i+=1)
if(inwave1[i]<crossing0)
print i
count0 += 1
endif
endfor
for (j=0;j<numPoints;j+=1)
if(inwave1[j]>crossing1)
print j
count1 += 1
endif
endfor
return count0
return count1
Wave inwave1
variable crossing0
variable crossing 1
crossing0 = 1
crossing1 = 9
//...(I will skip to the for loops)
for (i=0;i<numPoints;i+=1)
if(inwave1[i]<crossing0)
print i
count0 += 1
endif
endfor
for (j=0;j<numPoints;j+=1)
if(inwave1[j]>crossing1)
print j
count1 += 1
endif
endfor
return count0
return count1
A simple way to "find members" as you describe above is to use the Extract operation. Here is an example (from the documentation):
Extract/O source,dest,source>10 && source<20
Now if you want to find the minimum or maximum value of this subgroup simply execute:
Print WaveMin(dest)
I hope this helps,
A.G.
WaveMetrics, Inc.
May 29, 2013 at 03:39 pm - Permalink
Just a comment: Be aware that the function stops executing immediately once you hit a return statement, so the value of count1 will never be returned.
May 30, 2013 at 12:49 am - Permalink