For code generation, the maximum number of elements of an array is constrained by the code generator and the target hardware.
For fixed-size arrays and variable-size arrays that use static memory allocation, the maximum number of elements is the smaller of:
intmax('int32')
.
The largest integer that fits in the C int
data
type on the target hardware.
For variable-size arrays that use dynamic memory allocation, the maximum number of elements is the smaller of:
intmax('int32')
.
The largest power of 2 that fits in the C int
data
type on the target hardware.
These restrictions apply even on a 64-bit platform.
For a fixed-size array, if the number of elements exceeds the maximum, the code generator reports an error at compile time. For a variable-size array, if the number of elements exceeds the maximum during execution of the generated MEX in MATLAB®, the MEX code reports an error. Generated standalone code cannot report array size violations.