To download NI software, including the products shown below, visit ni.com/downloads.
You can perform basic manipulation of multi-dimensional arrays using the TestStand expression language, but more complex tasks are better suited for a code module. This example shows how you can perform basic manipulation on a multi-dimensional array.
Note: For manipulation of single dimensional arrays, refer to Example: Manipulating Arrays in TestStand Expressions
You can perform the following operations on multi-dimensional arrays within the expression language:
The following more advanced changes should be performed in a code module with more robust array manipulation capabilities, such as a LabVIEW VI or .NET assembly:
These tasks are not included in this example.
Initializing an Array
Initializing a multi-dimensional array using an array literal is not possible directly since the array literal format only supports single dimensional arrays. However, TestStand does provide a way to reshape a single dimensional array into a multi-dimensional array, which you can use to initialize a 2D array:
Locals.Array2D = {1,2,10,20,100,200}, Locals.Array2D.Type.ArrayDimensions.SetBounds({0,0},{1,2})You can use a similar technique to initialize a large array to a single value, using the single dimensional array functions to generate the elements, then reshaping it into a multi-dimensional array:
Locals.Array2D={},
SetNumElements(Locals.Array2D, 100),
SetElements(Locals.Array2D, 24),
Locals.Array2D.Type.ArrayDimensions.SetBounds({0,0},{10,10})
Obtaining an array subset
You can access a single row or column of an array using the ".." notation, as shown:
Locals.SingleColumn = Locals.Array2D[0..][1], Locals.SingleRow = Locals.Array2D[0][0..]
Using "[0..]" will obtain the entire row. Alternatively, you can specify a range of elements, such as "[2..3]" to obtain a subset of a row or column
Setting an Array Element
You can set individual elements using the following syntax, similar to single dimensional arrays:
Locals.Array2D[1][2] = 222
Clearing All Elements
Similar to a single dimensional array, you can clear a multi-dimensional array using an empty array literal.
Locals.Array2D = {}
TestStand 2014 or Compatible
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Thanks Kurt for posting. Could you please resave the seq file at 2013 test stand version? I have 2013 and can't open the 2014 file.