LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

union

I want to create a union data type in labview. I'm reading doubles(8) from the tcp/ip module and do not know how to assign the bytes so I can recreate the double.
0 Kudos
Message 1 of 2
(3,371 Views)
There is no union data type in LV as you have in C. If you need to convert data types use the Advanced>>Data Manipulation>>Type Cast function.

The TCP Read function gives you a string. Cut out the bytes where the double is and wire this string to the Type Cast function. Then LV will assign the data in memory a double data type.

Be sure the endianness of both machines is the same otherwise you have to reverse the bytes before type casting.

I made a module for a binary file which was written in another program. I first converted the string into a array of U8. Then is used the Index Array function to cut out the bytes and the Type Cast function to give it the correct data type. Since the data before the cast is an array you can use the Reverse Array function for endianness conversion which is much easier than with a cascade of swap bytes/word functions.
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 2 of 2
(3,363 Views)