LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read & convert little-endian stored binary doubles?

Does anyone know of a fast and efficient way to read and convert little-endian doubles stored in a binary file by another application into LabVIEW big-endian doubles? I wrote a VI that reads the file as an array of strings, takes an 8 char 'String Subset', 'Reverses the String' then 'Unflatten From String' into a LabVIEW double. It works but all that string manipulation seems inefficient. Neither the 'Swap Bytes' or 'Swap Words' LabVIEW VI's work on floating point values so that's out. Now if LabVIEW had a 64-bit integer...

Thanks
0 Kudos
Message 1 of 4
(4,494 Views)
Long ago there was an example with many possible ways to convert endian-ness, but it seems to have disappeared. I have attached this old version, but I don't remember where I found it and cannot take credit for it.

The attached image show one quick way to read a binary string and convert it to an array of DBL in the "other" endian representation. See if this works for you.
Download All
Message 2 of 4
(4,494 Views)
Maybe you are thinking about this link:

http://digital.ni.com/public.nsf/websearch/97332426D63630EE862565070049FFBB?OpenDocument
Message 3 of 4
(4,494 Views)
Thanks a lot! This is just what I was looking for. The jury's still out on whether or not it's any faster than my 'Unflatten From String' technique but I imagine it will be because of its simplicity. The VI between the 'Type Cast' VI's in the GIF image through for a few moments. It's the old 'Reverse 1D Array' icon from pre-LV 6.0 versions. Thanks again.
0 Kudos
Message 4 of 4
(4,494 Views)