From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to combine even and odd index of an array

Hi,

 

I have an array (u8). Let's the array is as below. Array size is always even

 

214

115

234

117

111

123

 

I would like to combine every even index value with the next odd index value and make 16bit array . odds are high bits and evens are low bits. Could you please let me how can I do it in LabVIEW?

 

115-214  or binary  0111001111010110

117-234

123-111

0 Kudos
Message 1 of 3
(2,869 Views)

Hi tintin,

 

typecast your U8 array to an U16 array. SwapBytes if needed:

check.png

Or use DecimateArray with Join…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,863 Views)

Decimate 1D Array followed by Join Numbers

 

You can also just use Type Cast to a U16.  At least on my system, you will have to use Swap Bytes after it to get the order you want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 3
(2,858 Views)