Data Definition Considerations for Code Generation
To generate efficient standalone code, you must define the following types and classes of data differently from when you run your code in MATLAB®.
Data | Type Considerations | More Information |
---|---|---|
Arrays | Maximum number of elements is restricted. | Array Size Restrictions for Code Generation |
Numeric types | Assign numeric type variables a value before using them in operations or returning them as outputs. | Best Practices for Defining Variables for C/C++ Code Generation |
Complex numbers |
| Code Generation for Complex Data |
Characters and strings |
| |
Variable-Size data | After initial fixed-size assignment to a variable, attempts to grow the variable might cause a compilation error. | |
Structures |
| |
Cell arrays |
| |
Tables |
Limitations that apply to classes also apply to tables. | |
Categorical arrays | Categorical arrays do not support these inputs and operations:
Limitations that apply to classes also apply to categorical arrays. | |
Datetime arrays |
Limitations that apply to classes also apply to
| |
Duration arrays | Duration arrays do not support these inputs and operations:
Limitations that apply to classes also apply to duration arrays. | |
Timetables |
Limitations that apply to classes also apply to timetables. | |
Enumerated data | Supports integer-based enumerated types only. | Enumerations |
MATLAB Classes |
| |
Function handles |
| Function Handles |
Dictionaries |
| |
Deep learning arrays |
|
The information in the preceding table is not an exhaustive list of considerations for each data type. See the topics in the More Information column.