02-06-2006 03:20 PM
02-07-2006 02:50 AM
Hi,
Have a look at the example AccessingArrays in the TestStand\examples folder.
The thing to remember is the index to the array is syntax as "[index]" eg "[0]" and similar 2d arrays its "[0][0]"
hope this helps
Regards
Ray Farmer
02-07-2006 11:57 AM
02-07-2006 02:51 PM
02-07-2006 03:18 PM
04-24-2007 06:55 PM
04-25-2007 09:45 AM
04-25-2007 09:52 AM
You can initialize arrays of arrays with nested array syntax: locals.x = { {1, 2}, {3, 4}}
However, currently there is no equivalent syntactical shortcut for initializing a multidimensional array (which is not the same thing as an array of arrays).
For a multidimensional array, you could:
- set each element in the editor
- explicitly initialize each element (perhaps in a long comma separated statement)
- write a loop (which could copy values from a single dimensional array or an array of arrays you initialize separately)
- pass the multidimensional array to a code module and initialize it there
04-30-2007 01:54 PM
04-30-2007 02:26 PM
Both in TestStand and C/C++, multidimensional arrays are different from arrays of arrays in that multidimensional arrays must be "square" (non-jagged) because element access is computed based on the full array dimensions. In contrast, arrays of arrays can be jagged. Element access is implemented by obtaining a reference or pointer to another array from a containing array, until you reach the last array which contains the elemental datatype.
To create an array of arrays in TestStand, create an array custom data type. Then create a variable that is an array of that custom datatype. By default your array of array will be "square", but you can resize individual sub-arrays to make it jagged.