02-18-2019 05:26 PM
Hi, using TestStand statements how do I add a row into a 2D array and a column into a 2D array?
Thanks.
02-19-2019 08:45 AM
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.
02-28-2019 11:46 AM
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.