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: 

Concatenate Elements of a 1D array

Hello,

Fairly simple question I'm just looking for an efficient way to do it.

I have a 1D array of HEX values and I would like to be able to combine 2 elements into 1 through out the whole array.

Ex: elements[0] and element[1] become element[0]. element[2] and [3] become element[1] etc.

 

EDIT:

I have attached an image to show what I am doing. I take a string, convert to hex and then into a 1D array. But ultimately I need to convert 2 ascii character into 1 hex! As of right now I have 1 ascii gets converted into 1 hex.

 

Thank you!

0 Kudos
Message 1 of 14
(8,211 Views)

Decimate1DArray followed by JoinNumbers… (Or any other operation you would like to do, it's not quite clear from your question!)

Best regards,
GerdW


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

Thank you for your reply, I edited my question adding some more detail and a picture.

0 Kudos
Message 3 of 14
(8,192 Views)

It would help us if you gave a very clear example of the data coming in and what you want as an output.  Doing it with a VI would be the best (set the example data values as the default before saving).


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 4 of 14
(8,176 Views)

GerdW already made this point, but here you have it illustrated in vi snippets.

a.png

b.png

0 Kudos
Message 5 of 14
(8,161 Views)

Hmm, I have a question considering your earlier question and this one, the strings you are reading, which do they look more like?

A) "0F AA 12 45 E4"

B) " !51 @#$@% ar12 12355"

 

Jon D
Certified LabVIEW Developer.
0 Kudos
Message 6 of 14
(8,135 Views)

Hello,

Thank you for the visual, that makes a lot of sense!

It almost works, my first 2 elements are 49, and 100, but when they get combined it becomes 12645... but I want it to be "49100" any ideas?

 

Thank you.

0 Kudos
Message 7 of 14
(8,127 Views)

Please help us help you by posting a VI with your data in it.

 

"100" hex will not fit in a U8 so please post a vi with your data and what you think it should be.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 14
(8,122 Views)

The strings look like B)

0 Kudos
Message 9 of 14
(8,114 Views)

 

Your various posts are not self consistant.

 

Post a VI wi the data you have and the results you expect.

 

Our assistance is limited by your willingness to cooperate.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 14
(8,107 Views)