NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

build array by concatenating 2 arrays

Solved!
Go to solution

Greetings,

 

I have the need to combine (qty. 2) 1D arrays in TestStand for the first time every. They both will be the same size always. I'd like to build by concatenating.

 

Array 1 (string): some number1, some number2, some number3

 

Array 2 (string): string description1, string description2, string description3

 

Output array: some number1 string description1, some number 2 string description2, some number3 string description3 (so it would be 3 elements total)

 

Thanks in advance for any help.

 

Chazzzmd

0 Kudos
Message 1 of 4
(4,876 Views)
Solution
Accepted by topic author Chazzzmd

Hi,

 

You can concatenate 2 strings in TestStand by using the "+" operator. 

Example:

Locals.Output = Locals.String1 + " " + Locals.String2

 

In order to concatenate individual string elements in the string arrays, one easy approach would be to use looping structure to iterate over the array and concatenate each of them. Please find below a simple sequence file (I created it in TestStand 2010) that does it using "For Each" looping structure as well as "Looping" property in the step settings. I hope this helps you.

With Best Regards,
Srivinayaka
National Instruments
0 Kudos
Message 2 of 4
(4,870 Views)

Srivinayaka ,

 

Thanks for the reply. I'm assuming the Locals.Output is a 1D array in your example correct?

 

Yes, I am familiar with triggering off iterations of a loop operation for element [] needs. Unfortunately that's not doable for this operation as the loop is performing a filter operation, meaning the iteration of the loop will not always matchup to the needs of the array. I'll have to do something like............

 

SetNumElements(Locals.Output,GetNumElements (Locals.Output)+1), Locals.Output[GetNumElements(Locals.Output)-1] =Locals.String1 + " " + Locals.String2

 

Thanks again for your help. I can't believe I totally skipped over combining strings for my insertion element. Geez

 

Chazzzmd

0 Kudos
Message 3 of 4
(4,835 Views)

Glad to be of assistance to you. 🙂

With Best Regards,
Srivinayaka
National Instruments
0 Kudos
Message 4 of 4
(4,797 Views)