LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem converting a string to array, and back again!

Sorting the coercion dot sorted all my problems. Thanks altenbach.
0 Kudos
Message 11 of 13
(634 Views)
I still think the TypeCast function is the better solution, and I'm curious as to why it doesn't work for you.
Message 12 of 13
(619 Views)


russelldav wrote:
Sorting the coercion dot sorted all my problems. Thanks altenbach.

I agree with smercurio_fc that the correct solution is the typecast function, but even for the typecast function you need to sort out your coercions.
 
Let's look at your code:
 
 
 
 
There are three coercion dots! one on the "byte array to string", one on the "Array" indicator, and one on the "Array 2" indicator.
 
From this it is clear that the original data coming from the left is NOT I16, but probably a 32 bit representation. All you need to do is ensure that the original wire is actually I16 and everything will fall in place.
 
Use typecast instead of all that byte gymnastics! 😄 If you use typecast, everything will be correct, no matter what the original representation is, as long as you cast it back to the same type it was originally.
0 Kudos
Message 13 of 13
(613 Views)