LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

retrieve flattened data into VB

We are writing a VB .net program that must be able to retrieve and iterpret, from a binary file, flattened, Labview, numeric data. Any suggestions on how to go about this?
0 Kudos
Message 1 of 4
(3,014 Views)
When you say flattened are you referring to having used the Flatten to String function? You can save data straight to binary, without flattening it by using the Write to Binary File function and then read it in VB.NET using a StreamReader object. If your data consists of arrays, be careful about whether or not you prepend the data with the size of the array.
0 Kudos
Message 2 of 4
(3,001 Views)
Yes, Flatten to String.  I'm using StreamReader to read the file and can identify the 8 bytes that correspond to the values that I need to convert to decimal numbers.  But I don't know what algorithm to use to convert them, i.e. 40 C3 88 00 00 00 00 00 is 10,000 and 40 14 00 00 00 00 00 00 is 5.000.
0 Kudos
Message 3 of 4
(2,986 Views)

Use the BitConverter class (in System). Pass in your array of bytes (may need to reverse the array depending on how you read them. Example:

 

(yes, it's in LabVIEW, but the same concept applies in VB.NET, since it's a .NET class)

 

 

FYI: the hex values correspond to IEEE-754 representation.

Message Edited by smercurio_fc on 03-30-2009 01:33 PM
Message 4 of 4
(2,977 Views)