LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NAN?

Hi,

 

I am using the chassis for compact DAQ with NI 9211 24 bit thermocouple differential analog input module. I have made a program in labView to determine mass flow etc…

However, once the mass flow has reached a value close to zero during a test, the indicator shows NAN. Is there a way to change that to a value of 0?

Thank a lot

 

Regards-Glenn

0 Kudos
Message 1 of 13
(4,879 Views)

NaN means Not a Number and is a special value defined for an invalid number (like what you get if you divide by 0), so your number should not be "close to 0" but an invalid number.

If you still want to display 0 instead of NaN, you can use the Not a Number\Path\Refnum function from the comparison palette which will return T if the number is NaN and replace the value, but I would not recommend that in most cases.


___________________
Try to take over the world!
0 Kudos
Message 2 of 13
(4,872 Views)
Glenn,

NaN (Not a Number) occurs when some mathematical operations such as divide by zero occur.

Best is to test the data before it enters an operation which could result in NaN. If you cannot do that, use the Not A Number? function from the comparisons palette to detect the NaNs and replace them with 0 or what ever is appropriate.

Lynn
0 Kudos
Message 3 of 13
(4,870 Views)
Yes. The comparison palette has a test for "Not a number/path/refnum". Use a select as in the image below.
 
 
Of course it could be that the NaN points to some fundamental problem that should be adressed earlier. Do you know why you are getting NaNs? 😉

Message Edited by altenbach on 03-12-2007 10:24 AM

Message 4 of 13
(4,871 Views)
Either I have to type really fast or refrain from making images to avoing being in third place all the time. 😄
0 Kudos
Message 5 of 13
(4,861 Views)
"
Either I have to type really fast or refrain from making images to avoing being in third place all the time.
"
 
Well you still manage to beat me to the punch even with images!
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 13
(4,855 Views)
The rest of us just want to make sure the best is saved for last.

Lynn
0 Kudos
Message 7 of 13
(4,849 Views)

Thanks guys.

That s really helpful

 

Glenn

0 Kudos
Message 8 of 13
(4,825 Views)

A little off-topic, but here's one little NaN tidbit:

I've found them useful as default values on wired controls in (semi-)intelligent subvi's.  This gives me a means for determining whether the caller function wired an input or not.  After checking for NaN, I can then decide whatever I want to use as a replacement value, and that decision can be dynamic. 

For example, I may store the most recent "legal" input in an unitialized shift register, which I can then use in place of an unwired "NaN" input.  Or I may make a vi for PV=nRT which can auto-detect which inputs are wired and know how to calculate the other parameter.  Etc.

Share and enjoy...

-Kevin P. 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 9 of 13
(4,799 Views)


@Labtrainer wrote:

Thanks guys.

That s really helpful


Glenn,

You're welcome! One easy way to thank would be to just look in the lower right corner of each reply and click on the circle that's all the way to the right. 😄

Christian

0 Kudos
Message 10 of 13
(4,793 Views)