
"NaN" not recognized in condition statement

PeterR
I have an experimental setup with 15 slots and I am trying to have Igor find out how many samples the user has entered by reading out the appropriate values from the result wave, "Nan" would represents a slot that the user did not use.
However, the if-construct does not correctly recognize whether there is data or not:
//Count occupied slots by counting filled rows in conc_xaxis Function count_occupied_slots() Variable check,x, samplecounter=0 for(x=0;x<15;x+=1) check = conc_xaxis [x] if(check == Nan) print "There is no sample in slot "+num2str(x+1) else samplecounter=samplecounter+1 endif endfor print "Samplecounter report: There are "+num2str(samplecounter)+" used slots in current experiment." End
The sample counter ALWAYS returns 15. Which is wrong, when the wave contains rows with "NaN" (empty slots) - where is the bug?
Thanks in advance,
regards,
Peter
numtype(num)
function instead.August 4, 2014 at 02:49 am - Permalink
Regards,
Peter
August 4, 2014 at 02:53 am - Permalink