05-24-2019 05:21 AM
I have an instrument that when I read it I get 32 bit floating point data back from the buffer. There are two pieces of data per measurement point and multiple measurement values returned within the buffer.
How do i convert this IEEE 32 bit buffer data into an array of numeric data using LabView?
I should get an array of values around +8.704706E-009
I have displayed the format and what i get in the attachment.
Solved! Go to Solution.
05-24-2019 05:41 AM
A Single is a 32 bit floating point, so you only need to extract the 4 bytes and typecast it.
/Y
05-24-2019 07:28 AM
Use Unflatten from String instead of the Typecast as it allows you to select the Endianess of the binary stream data. Typecast always assumes that the binary data is in the LabVIEW default Endianess which is Big Endian.
05-24-2019 04:27 PM - edited 05-24-2019 04:34 PM
@stevesteve wrote:
I have an instrument that when I read it I get 32 bit floating point data back from the buffer. There are two pieces of data per measurement point and multiple measurement values returned within the buffer.
How do i convert this IEEE 32 bit buffer data into an array of numeric data using LabView?
I should get an array of values around +8.704706E-009
I have displayed the format and what i get in the attachment.
This will get you started. You will need to modify the VI in order to correctly read the raw data from your instrument. In this case, the number of Bytes that follows the header is 3208. That's 401 measurements * 2 datasets * 4 bytes (401*2*4=3208).
Rolfk's advise to use "Unflatten from String" is spot on. The data is little-endian.
The two sets of data are interleaved. Easiest way is to extract each dataset is to use "Decimate 1D array". In my experience, if the second dataset is undefined on the instrument, then it sends back all zeros.
EDIT: the attached VI is ver 2014
05-27-2019 01:06 PM
Thanks a lot for you help, its just what I needed, saved me lots of time.
Cheers