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.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert Row and Column Into 2D Array

Hi, using TestStand statements how do I add a row into a 2D array and a column into a 2D array?

Thanks.

0 Kudos
Message 1 of 3
(2,393 Views)

The native TestStand array operators are mostly designed for 1D arrays.  In general, you'd have to redimension into a 1D array, perform the array operation (e.g. insert), and then redimension back.  As described here, it's recommended that these kind of operations on multidimensional arrays should be done in a code module.

Message 2 of 3
(2,358 Views)

Hi testdesign,

 

pulidotech is right, working with 2D arrays in TestStand can be klunky and painful. You would typically just want to size the array to be large enough and then manipulating rows and columns using the range operator (under other section "Double Dot") is pretty straight-forward. If you really need to resize the array in TestStand, you can add columns pretty readily using SetArrayBounds ("SetArrayBounds(Locals.myArray, "[0][0]", "[1][2]")" would be the expression syntax to add a column to a 2x2 array). However, if you try to use this to add rows, it will jumble your array order so you would want to transpose first, then add a column and transpose back. There isn't a transpose function baked into TestStand, so you would have to perform the transpose manually. At the end of the day, this is all much easier in a code module.

Regards,
0 Kudos
Message 3 of 3
(2,322 Views)