LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combine array elements

Solved!
Go to solution

I have a 1D array:

RFeng_0-1589633415517.png

 

I want to combine the first 2 digits into a single digit to get:

 

RFeng_1-1589633490039.png

 

Can't seem to find a way of doing this.

 

 

0 Kudos
Message 1 of 5
(3,069 Views)

a(0) = a(0)*10+a(1)...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(3,057 Views)
Solution
Accepted by topic author RFeng

There are probably ways of simplifying this but as I don't know exactly what the use case is I have just shown you how you could do exactly what you have asked.

0 Kudos
Message 3 of 5
(3,052 Views)

Hi R,

 

another approach:

Now the array can have more than 3 elements.

Still there might occur problems when those two elements will be "bundled" into a value larger than Max(I32)…

Best regards,
GerdW


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

Your question is ambiguous because you don't even define the datatype of the array (numeric or string).

 

Assuming the simplest possibility, here's my solution. No need for any math:

 

altenbach_0-1589733904094.png

 

 

Next time try to define the problem better. It would have helped tremendously if you would have attached a small VI containing typical data. Can you guarantee that all array elements contain single numeric digits? Can they be negative? If the first element is zero, do you want to display the leading zero in the result? Are hex digits allowed? So many unanswered questions!

 

 

0 Kudos
Message 5 of 5
(2,950 Views)