Arrays and Matrices of Record Type – Special Features
Arrays and matrices of record type have some special features:
- An array/matrix of record type is generated as an array/matrix of pointers to the record component structure.
- In the generated code, each array/matrix element is initialized separately.
- The number of array/matrix elements is the max. size of the array/matrix, even if the array/matrix is variant. An extra "current size" (as specified in the X-Size and Y-Size fields of the table editor) is not supported.
- The access uses plain C syntax instead of the protected functions in the system library (Vec_<type>_getAtProtected, Vec_<type>_setAtProtected, Mat_<type>_getAtProtected, Mat_<type>_setAtProtected), since the latter are not available for generated component types. If index protection is enabled, it will be generated for the max. size(s) of the array/matrix (as specified in the X and Y fields of the element's properties editor).
For an array/matrix of record type, each array/matrix element is counted as a separate instance element. If the calculated number of instance elements exceeds the maximum number supported by the L1 protocol, an error (MIle150) is issued:
Too many instance variables (<n>) -- simulation data structures support only up to 65535 elements -- maybe problem is due to big arrays/matrices of record
In the experiment window (offline, online or back animation), an array/matrix of record type is displayed as a tree structure, with the array/matrix elements as children of the array/matrix. The names of the array/matrix elements are derived from the name of the record type and the index of the array/matrix element, e.g., Record[0] or Record[1][2]. See also the
example.- The generated initialization code for arrays/matrices of record type is not affected by the setting of the Generating Sparse Arrays target option.
See also
Table Editor – Window Elements
Properties Editor for Basic Elements
