LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading 32 bit floating point number into labview

Hi,

I am trying to read a binary file which has a header of 6090 byte and 256 data points each recorded in 4 bytes (My guess is that it is 32 bit floating point numbers) into labview.  The original file has not been generated by labview.

I have been using "Read Binary File.vi" supplied with examples in labview but it doesn't seem to read the values correctly. 

I modify the program to read 32-bit numbers by wiring a SGL formated labview constant into byte stream type.   The program reads reasonable numbers correctly but the data seems to be "digitized" wrong. (instead of smooth ramp from -2 to 2, you get discrete steps -1.5, -.5, .... .5, 1.5 and so on)

Any remedies?







0 Kudos
Message 1 of 5
(3,582 Views)


@MasaUMD wrote:
...My guess is that it is 32 bit floating point numbers...

Guessing is typically not recommended! 😉

Can you attach your data file, it should be easy to find the correct data type by trial and error. Don't forget that it could also be a problem with little endian vs. big endian. What is your LabVIEW version?

 


 

0 Kudos
Message 2 of 5
(3,579 Views)
Much as I hate to admit it Smiley Wink, it is much easier to find out your data format and "endian"ness using a hex editor than using LabVIEW.  There are a variety of good ones available, both free and commercial.  I use Frhed, a free one which can be found on the Pricelessware website, but there are many others.
0 Kudos
Message 3 of 5
(3,552 Views)
Thanks for the suggestions,

I am attaching a vi (which is a modified version of the read binary data which is sent with labview) and a test file.  You can use it to see what my problem is if you are compelled to see it.

I am currently using Labview 7.1.  And I'll look into endian and nonendian. 

Masa










Download All
0 Kudos
Message 4 of 5
(3,539 Views)
Do you have any idea what the data should look like? For example largest and smallest values or ranges.

As DFGray said, a hex editor can be useful. I wrote one in LabVIEW.

Your data file has 4096 bytes starting at offset 6091. That is 16 bytes per number if you have 256 numbers. The pattern of the data repeats with 4 byte period, making 1024 4-byte values more likely. 60A4 BD00 60A4 BD00 00A5 BD00 ...

Lynn
0 Kudos
Message 5 of 5
(3,529 Views)