Variable-Size Data - MATLAB & Simulink (original) (raw)

Code generation for arrays that change size in the generated code

During code generation, the code generator identifies arrays, including scalars, vectors, and matrices, as either fixed size or variable size.

Understanding how the code generator handles fixed- and variable-size arrays can help you to diagnose and fix errors during code generation. If your application does not require variable-size arrays, you can also fine-tune variable sizing and dynamic memory allocation to potentially improve the performance of the generated code.

Functions

coder.areUnboundedVariableSizedArraysSupported Check if current configuration settings allow unbounded variable-size arrays (Since R2024a)
coder.varsize Resolve size incompatibility errors and declare upper bounds

Topics

Troubleshooting

Resolve Error: Arrays Have Incompatible Sizes

Troubleshoot size incompatibility errors that occur during code generation.

Resolve Error: Fixed Size on the Left Side but Variable Size on the Right

Troubleshoot errors when assigning variable-size arrays to fixed-size arrays.

Resolve Error: coder.varsize Not Supported for Strings

Troubleshoot code generation error when using coder.varsize with string variables.