Data Definition
How defining data in MATLAB Function blocks differs from
defining data for MATLAB® code
MATLAB variables can change their properties at run-time. The same variable can hold a value of any class, size, or complexity.
The MATLAB Function block must determine variable types at compile-time. Control how data is represented and how memory is allocated by how you design your MATLAB Function block code. Follow the described guidelines to allow the block to determine the types of variables when compiling the block or generating code from the block.
Data Definition Basics
- Data Definition Considerations for Code Generation
- Best Practices for Defining Variables for C/C++ Code Generation
- Reuse the Same Variable with Different Properties
- Eliminate Redundant Copies of Variables in Generated Code
- Array Size Restrictions for Code Generation
- Code Generation for Constants in Structures and Arrays
- Generate Code for Growing Arrays and Cell Arrays with end + 1 Indexing
Categories
- Numeric Types
Numeric type data and variables in MATLAB Function blocks
- Array Layout
Column-major and row-major order for array storage
- Characters and Strings
Code generation for text
- Variable-Size Data
Definition and differences for code generation
- Structures
Definition and supported structure operations
- Cell Arrays
Definition and use of cell arrays, differences for code generation
- Tables
Definition and use of tables for MATLAB Function blocks
- Categorical Arrays
Definition and use of categorical arrays for MATLAB Function blocks
- Datetime Arrays
Definition and use of datetime arrays for MATLAB Function blocks
- Duration Arrays
Definition and use of duration arrays for MATLAB Function blocks
- Timetables
Definition and use of timetables for MATLAB Function blocks
- Enumerations
Definition and use of enumerated data for MATLAB Function blocks
- MATLAB Classes
Definition and use of MATLAB classes, differences for code generation
- Function Handles
Code Generation for function handles
- Dictionaries
Definition and use of dictionaries in MATLAB Function block