LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a flattened LabVIEW data string from a CSV file in C#?

We're recording a large amount of data into a CSV file to make it easily accessible from the C# end. I've a header with all the variable names then I write all the data (doubles) as flattened LabVIEW binary strings using flatten to string (little endian) to keep the size down. We are having issues converting these strings back to doubles on the C# end.

At the C# end we can read the LabVIEW repesentation of the DBL but have tried the BitConverter.ToDouble library function to convert it without luck. We use this method to convert the same flattened data coming over a TCP connection without any problems. I'm not writing the C# part of the program and have little experience with it, but if anyone could shed some light, it would be greatly appreciated.

Regards,

Andrew

0 Kudos
Message 1 of 3
(2,905 Views)

Are you feeding an array or a single numeric value into the Flatten To String function? If it's an array be aware that the function will, by default, prepend the array size to the string.

0 Kudos
Message 2 of 3
(2,886 Views)

It is all written as single values. It looks like we have found a method if we remove the header which contains the variable name as a string so the data is in a csv containing just the binary data strings. It looks like we'll go with this as the data will always be written in the same order so can be indexed by the C# program without the need for headers.

Thanks.

0 Kudos
Message 3 of 3
(2,877 Views)