From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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
(5,140 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
(5,132 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
(5,131 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
(5,128 Views)

Hi Doug,

 

that is a nice feature.

Thanks for pointing out.

 

Regards

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 5 of 5
(5,110 Views)