LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing or blank values

I have a program that normally calculates a value from a derivative curve valley location. If that derivative curve does not have a valley, the calculation is meaningless and the value normally calculated and stored in a file should in this case be a blank or a missing value. How can I store a missing value in an array location that normally is a numeric value?
0 Kudos
Message 1 of 4
(2,923 Views)
I would suggest using a value such as NaN (not a number) to indicate elements in the array which contain non-valid data. Use a case statement within your application which either populates the array with the correct numerical value or the NaN constant should the calculation prove to be invalid.

There is no way (that I am away of) to leave individual elements in an array empty. You can demonstrate this be generating a 10 x 10 2D array on the front panel of a VI. Next insert a numerical value into element (10,10). You will notice that LabVIEW will automatically fill all array elements back to (0,0) with a value of 0 using the data type set up for the array (DBL, I32 etc.)

Jeremy
Message 2 of 4
(2,923 Views)
I wanted to add that NaN is only viable for floating point numbers. If you are using an integer, you will have to designate a bad value. For instance, many LabVIEW functions use -1 in a signed 32 bit number repensentation to designate default values when the only valid numbers are positive.

You can also change the default value of the numeric indicators by creating a new control. The new control will look and act just like a numeric except it will be modified to have -1 or NaN as the default values. This way you can build an array of your numeric control which when grown will have the default values of your choosing.

You can learn more on how to do this by reading "LabVIEW Custom Controls, Indicators, and Type Definitions". You can find it o
nline but it is also a shipping document. Open LabVIEW 6.1 >> help >> search the LabVIEW bookshelf. This opens a pdf of all the shipping documents which are a great place just to learn more about how LabVIEW works. Look toward the end of the pdf for the link to the custom controls one.
0 Kudos
Message 3 of 4
(2,923 Views)
Thank you very much for your response. I will pursue your suggestions.
0 Kudos
Message 4 of 4
(2,923 Views)