Creating an Array or Matrix
In the Elements palette or toolbar, click the
Array or
Matrix button. The properties editor is opened. Since arrays and matrices are created as variables, the Non-Volatile attribute is deactivated.
In the Kind combo box, select Variable, Interrunnable Variable or Parameter.
Set the dimension(s) and the variant size(s) of the array or matrix.
In the X (and Y) fields, enter the maximum X (and Y) size of the element.
To specify a variant size, use the Variant Size field to select the system constants you want to use as dimension values.
Both normal and user-defined system constants can be used. The value of a system constant should be in the range 1 ... X (or 1 ... Y).
To specify a variable size, use the Variant Size field to select *.
Arrays/matrices of record type cannot have variable sizes.
The X (and Y) field(s) are disabled.
In the Basic Type combo box, assign the element type.
The basic scalar types, Enumeration, and Record are available. If you select Enumeration or Record, the
following happens.Adjust the other element properties as described in Editing the Configuration of an Array or Matrix, then click OK.
If you exceeded the maximum size of the element axes in the Dimension fields, the following warning opens.
The possible max size has to be between 1 and 65535. Please adjust your settings.
If the product of the X and Y dimensions of a matrix exceeds the maximum size of the matrix, the following warning opens.
The possible matrix elements max size of 1048576 has been exceeded. Please adjust your setting <number>.
- Confirm the warning with OK and adapt the dimension(s).
If you selected a system constant whose value is outside the allowed range, the following warning opens:
The Attribute * Size (<n>) is not in the allowed range of >0 and max value (<i>)
- If you are working in the block diagram editor for SWCs, place the element in the drawing area.
- If necessary, re-open the properties editor and adjust the size.
Note |
|---|
If you use matrices as interrunnable variables, make sure that the Number of dimensions for fixed matrixestarget option is set to Two-dimensional. Otherwise, a warning WMdl653 is issued during AUTOSAR code generation. By default, this warning is promoted to an error. |
Since the ANSI-C target does not allow the activation of the Generating Sparse Arrays target option, you cannot optimize the initialization code for arrays/matrices used as variables or parameters in SWCs.
See also
Editing the Configuration of an Array or Matrix
Variant Size for Arrays and Matrices
Variable Size for Arrays and Matrices