Matrix
A matrix (type symbol
) is a two-dimensional, indexed set of elements which have the same scalar or enumeration or record data type. The type of index for each dimension is the same as that of an array, i.e. a non-negative integer. The total size of a matrix is limited to 1048576 elements. The size of each axis is limited to max. 65535, and the product of the axes sizes must not exceed the total size limit. The indices take values between 0 and size ‑ 1.
Note |
|---|
You cannot edit the data of a matrix with one or both axes larger than 63 in the table editor. Instead, proceed as described in Editing Data of a Large Array or Matrix. |
The interface of a matrix used as variable consists of the following methods:
setAt(a, i, j): The assignment of the value a to the position (i,j) in the matrix.
a can be any supported type, i and j must be non-negative integers.
- getAt(i, j): Returns the value at position (i,j) of the matrix.
- xLength(): Returns the current X size of the matrix. For matrices of record type, the max. X size is returned.
- yLength(): Returns the current Y size of the matrix. For matrices of record type, the max. Y size is returned.
The interface of a matrix used as parameter consists of the methods getat(i, j), xLength() and yLength().
The interface of a matrix used as message depends on the message type.
Message type | |||
Send | Receive | Send & Receive | |
setAt(a, i, j) | + | + | |
getAt(i, j) | + | + | |
xLength() | + | + | + |
yLength() | + | + | + |
Note |
|---|
Matrices of record type can be exported only in AMD format V6.4.3 and higher, matrices of enumeration type can be exported only in AMD format V6.4.2 and higher. A matrix with one or both axes larger than 63 can be exported only in AMD format V6.4.3 and higher. Older AMD formats will result in an export error. |
Matrices 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 matrix indices against over- or underflow.
You can use the Generating Sparse Arrays target option to optimize the generated initialization code for matrices 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