Array
An array (type symbol
) is a one-dimensional, indexed set of elements which have the same scalar or enumeration or record data type. The position of a value within an array is indicated by its associated index value, which must be a non-negative integer. The size of an array is limited to 65535. The array index takes values between 0 and <size>-1.
Note |
|---|
You cannot edit the data of arrays larger than 2048 elements in the table editor. Instead, proceed as described in Editing Data of a Large Array or Matrix. |
The interface of an array used as variable consists of the following methods:
setAt(a, i): The assignment of the value a to the position i in the array.
a can be any supported type, i must be a non-negative integer.
- getAt(i): Returns the value at position i of the array.
- length(): Returns the current size of the array. For arrays of record type, the max. size is returned.
The interface of an array used as parameter consists of the methods getAt(i) and length().
The interface of an array used as message depends on the message type.
Send | Receive | Send & Receive | |
setAt(a, i) | + | + | |
getAt(i) | + | + | |
length() | + | + | + |
Note |
|---|
Arrays of record type can be exported only in AMD format V6.4.3 and higher, arrays of enumeration type can be exported only in AMD format V6.4.2 and higher. Arrays with more than 2048 elements can be exported only in AMD format V6.4.3 and higher. Older AMD formats will result in an export error. |
Arrays of non-scalar basic types or complex (user-defined) types other than records are not available.
In the context of a project, you can use the Protected Vector Indices option to protect the array index against over- or underflow.
You can use the Generating Sparse Arrays target option to optimize the generated initialization code for arrays of scalar or enumeration type; see Initialization of Composite Elements.
See also
Editing Data of a Large Array or Matrix (Data Editor)
Editing an Array or Matrix (Data Editor)
Arrays and Matrices of Record Type – Special Features
Variant Size for Arrays and Matrices
Variable Size for Arrays and Matrices
Initialization of Composite Elements