Array (data type)
SimTalk provides array data types. An array is a one-dimensional or a two-dimensional value field of one of the base data types listed above under Data Types.
Base data types can be all data types except for table, list, stack, and queue. When you enter any as the base data type, each item of the value field can have a different data type. Then, even lists and tables can be placed in the array.
Array indexes are one-based, i.e., they start at 1, not at 0.
You can declare array variables as follows:
a : integer[10] |
When you enter a single number within the square brackets, this is a one-dimensional array of fixed size, for example a : integer[10].
When you enter two numbers within the square brackets, this is a two-dimensional array of fixed size, for example b : boolean[10,20].
When you do not enter any number at all within the square brackets, this is a one-dimensional array, whose size is not fixed, and which is empty initially, for example a : string[].
Compare this example:
var vector3 : real[3] -- one-dimensional array with 3 real values |
Plant Simulation displays empty arrays with an empty space between the brackets like this "[ ]", compare the following example:
var a : real[] |
The Functions for Accessing 3D Objects make extended use of the array data types.
Compare the sample models: Click the Window ribbon tab, click Start Page > Getting Started > Example Models and click Small Examples. Then, select the respective Category, the Topic, and the Example in the dialog Examples Collection and click Open Model.
Related Topics