LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ieee32 to LV float

Hi,
I have an array of 100 bytes in Labview.Each 4 bytes  represents an IEEE32 float number.  Before I transfer  each 4 bytes to lavbiew float I was told that I need to reverse each  4 byte vector. Could someone show how do I get from this byte array a valid Labview float  type array so I can plot it? Thanks.

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

First you need to typecast the 100bytes to an array of SGL (assuming it is big endian), then convert it to DBL using "toDBL". You can also plot the SGL directly, so you don't really need the last step.

Attach a VI containing some real data (100bytes) as a diagram constant so we can make a small demo.

Message 2 of 5
(3,073 Views)
altenbach,
Thanks for response I don't have a sample data  at this point because I gather data from a UPD source  and this source is off for now.   But I have prototyped this  VI which I believe is  wrong  because it is very different from what you described.   I believe any 100 byte array will be ok for testing purposes.  Thanks.

0 Kudos
Message 3 of 5
(3,066 Views)
I have wrote a subVI which uses some ideas from altenbach.  Please let me know what you think.  All I do is invert each 4 byte and then cast it into single precision.  Thanks.

0 Kudos
Message 4 of 5
(3,060 Views)


RSibagatullin wrote:
All I do is invert each 4 byte and then cast it into single precision. 
OK, so you have little-endian data...
 
It is not clear why you are using byte arrays as inputs, becauser from UDP you get a string and it is probably more reasonable to work with strings directly. It's the same data.
 
Unflatten from string has endian conversion built-in, so that's all you need.
 
See attached.
0 Kudos
Message 5 of 5
(3,043 Views)