NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Append 1d array to 1d array

Hi All,

I wonder if there is a way to append 1D array to another 1D array in TestStand other than by copying element by element in a loop?

Also if a part of array, say, Array_1 which has 10 element need its elements from 5 to 10 to be appended to another array at the bottom. currently I use loop. But I wonder other than looping each element of the array to another array is there any standard functions or TS APIs available like in LabVIEW?

 

Thanks,

JKV

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

SetNumElements(Locals.Sum, (GetNumElements(Locals.Array1) + GetNumElements(Locals.Array2))), //Allocate Array For Sum
Locals.Sum = Locals.Array1 + Locals.Array2

 

It worked for me.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 5
(3,630 Views)

Actually you don't even need the first line.  It still works.

 

To get a subset of an array you can copy the array over to a temporary array and then use the RemoveElements() function to remove the parts you don't want.  Then add that temporary array to your other array.

 

Hope this helps,

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 3 of 5
(3,629 Views)

@JKV999 wrote:

Hi All,

I wonder if there is a way to append 1D array to another 1D array in TestStand other than by copying element by element in a loop?

Also if a part of array, say, Array_1 which has 10 element need its elements from 5 to 10 to be appended to another array at the bottom. currently I use loop. But I wonder other than looping each element of the array to another array is there any standard functions or TS APIs available like in LabVIEW?

 

Thanks,

JKV


For the second question, in newer versions of TestStand (I think this feature was added in 2012), you can do the following:

 

Locals.newArray += Locals.Array_1[5..9] // NOTE: assuming array is 0-based so has elements 0-9

 

-Doug

Message 4 of 5
(3,626 Views)

Hi Doug,

 

that is a nice feature.

Thanks for pointing out.

 

Regards

Juergen

--Signature--
NIWeek 2017: Standardized HIL Test Automation With TestStand
NIWeek 2016: Capturing ATE Requirements With Requirements Gateway

Feedback or kudos are welcome
0 Kudos
Message 5 of 5
(3,608 Views)