LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from Measurement File returns NaN

I write three channels of data of unequal length using the Write to Measurement File vi. However, when I read the same data using the Read From Measurement File VI I get NaN output for two channels. Numbers of NaN is equal to the number of readings in the longest channle minus the number of channel in the respective channel. Can anyone point me to appropriate direction.

0 Kudos
Message 1 of 6
(3,021 Views)

Even for unequal length of data you should get zero instead of NaN. It seems to, do changes in the file settings. Its better you post your code.

0 Kudos
Message 2 of 6
(3,004 Views)

I disagree.  Why should uneven data show a value of zero rather than NaN?  Zero can be a perfectly valid data point.  NaN tells you it is not a valid data point.

0 Kudos
Message 3 of 6
(2,999 Views)

Hi Raven sorry that i had given wrong info.

If we input array to the "Write to measurement file.vi", we get zero.

If we input waveform signal to the "Write to measurement file.vi", we get NaN for unequal length of data when we read it back.

 

 

Please see the attached screenshots. 

Download All
0 Kudos
Message 4 of 6
(2,975 Views)

You are dealing with 3 different datatypes.

 

1.  A 2-D array of doubles.

2.  A 1-D array of waveforms (each waveform has a 1-D array of doubles as a part of it)

3.  A blue wire dynamic datatype.

 

The blue wire dynamic datatype is a big mystery as to what goes on in there.  It is pretty powerful in that it can contain all different kinds of data, but it also obscures what the real data is going on in there.

 

In order to go between these datatypes, you are either using the blue express VI to convert to or from dynamic data.  Or you are using a coercion of the data type (red dot at an input to a function) and you have 2 of those in the Write waveform data.png.

 

So whether you get a zero or get an NaN is determined by the conversion.

 

In Write data array.png, you have two different arrays of different lengths.  When you build them into a 2-D array, the short rows get filled in with the default data of 0.

In Write waveform data.png, you are dealing with the waveform data type and the blue dynamic data.  The conversion VI's and the coercion for this must know enough to replace the missing data with NaN when it writes it to the file.

 

Message 5 of 6
(2,952 Views)

Hi Raven, Thank you for the reply and i find the mistake.

 

This time i am writing the waveform signal with channel1-1000elements, channel2 100elements, and i am using the merge signal function instead of build array.

 

When i extract the channel2 data from it using split signal function i am getting only 100element in the 2nd channel array.

 

But when extract the same signal from the read measurement file.vi, the channel2 data array will be having NaN after 99th index up to 999th index.

 

Please see that in the attached vi (saved in 8.6)

0 Kudos
Message 6 of 6
(2,935 Views)