Structures
You can define variables inMATLAB FunctionandMATLAB Systemblocks as structures.
Blocks
MATLAB Function | IncludeMATLABcode in models that generate embeddable C code |
MATLAB System | IncludeSystem objectin model |
Functions
coder.cstructname |
Name C structure type in generated code |
Topics
- Create Structures in MATLAB Function Blocks
Follow guidelines for creating structures.
- Define and Use Structure Parameters
Use the Symbols pane and Property Inspector to add a structure variable to aMATLAB Functionblock.
- Define Scalar Structures for Code Generation
Adhere to code generation restrictions for scalar structures.
- Define Arrays of Structures for Code Generation
Adhere to code generation restrictions for arrays of structures.
- Attach Bus Signals to MATLAB Function Blocks
Use structures in aMATLAB Functionblock.
- Initialize Matrix Using a Nontunable Structure Parameter
Use a nontunable structure parameter input to initialize a matrix output.
- Index Substructures and Fields
Refer to field values individually In aMATLAB Functionblock.
- Assign Values to Structures and Fields
Follow guidelines for assigning values to structures and fields in aMATLAB Functionblock.
- 通过大型结构作为输入参数
To avoid memory issues, pass large structures by reference.
- Structure Definition for Code Generation
Use structures in MATLAB®code intended for code generation.
- Structure Operations Allowed for Code Generation
Use structure operations that code generation supports.
- Types of Structures in MATLAB Function Blocks
Structures can be inputs, outputs, local variables, persistent variables, or parameters.
- How Structure Inputs and Outputs Interface with Bus Signals
Connect structure inputs and outputs in aMATLAB Functionblock to bus signals.
- Rules for Defining Structures in MATLAB Function Blocks
Adhere to restrictions for using structures in aMATLAB Functionblock.
- Limitations of Structures and Buses in MATLAB Function Blocks
Structures inMATLAB Functionblocks support a subset of the operations available for MATLAB structures.