LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

join/split integers

Can I use join/split function (in Data Manipulation) for intergers? Help shows it takes two unsigned numbers and returns one joined unsigned number. Like U16 and U16-> U32. What if I want I16 and I16 -> I32? Can I use the name function?  

0 Kudos
Message 1 of 4
(3,359 Views)
Yes, you can use the join/split functions on integers. You can even split/join a 16-bit value to/from 8-bit integers. I suspect though I haven't tried that these functions would also work for 63-bit integers.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 4
(3,355 Views)

Yes.

 

Just right click the input constant/control and select from "Representation", the desired one.

 

 

[Edit: Aarghhh Mark beat me by a couple of seconds..... ]

Message Edited by Mathan on 10-07-2009 10:33 PM
0 Kudos
Message 3 of 4
(3,353 Views)

While you can do it, the result doesn't make much sense to me. A signed value will have the most significant bit set to 1. Joining numbers simply copies/shifts bits. Thus, for signed numbers this operation doesn't give you a result that is equivalent to joining unsigned numbers. Take the following example in joining two 8-bit signed integers:

 

Note that the joined number has the bits copied in the same way that unsigned numbers would have. But what does it mean? Should bit 8 of the joined number remain a 1? It was a 1 in "Numeric 2" only because the value was negative.

 

Now, what about the reverse case when you want to split an I16 that happens to be negative? Should both I8 values be set to 1 for their most significant bit?

 

At the very least you would have to handle sign expansion. 

 

 

Message Edited by smercurio_fc on 10-07-2009 10:57 PM
Message 4 of 4
(3,344 Views)