MATLAB® variables can change their properties at run time. The same variable can hold a value of any class, size, or complexity. Statically typed languages such as C/C++ must determine variable types at compile time. Follow the described guidelines to allow the code generator to determine the types of variables when generating code. Code generation allows reassignment of a variable to a value of different class, size, and property. Code generation supports special MATLAB data types such as complex data, half-precision floating-point types, and sparse matrices.
|Construct half-precision numeric object|
Define data in MATLAB code intended for code generation.
Define the class, size, and complexity of variables in MATLAB source code before using them.
Follow guidelines for defining variables in MATLAB code intended for code generation.
coder.nullcopy to indicate
that the code generator can allocate memory without initializing it.
Reassign a variable with a value of different class, size, or complexity.
Reuse a variable with different properties when the code generator can determine the properties of each occurrence of the variable.
Use complex data in MATLAB code intended for code generation.
Use sparse matrices in MATLAB code intended for code generation.
Sometimes the code generator does not recognize constant structure fields or array elements.
The code generator and the target hardware constrain the maximum number of elements of an array.
C/C++ and GPU code generation support for functions that support half-precision inputs.