结构体
定义和支持的结构体操作
您可以将 MATLAB Function 和 MATLAB System 模块中的变量定义为结构体。
模块
MATLAB Function | 在 Simulink 模型中包含 MATLAB 代码 |
MATLAB System | 在模型中包含 System object |
函数
coder.cstructname | 在生成代码中命名 C 结构体类型 |
主题
- 在 MATLAB Function 模块中创建结构体
遵循创建结构体的规范。
- Index Substructures and Fields
Refer to field values individually In a MATLAB Function block.
- Initialize Matrix Using a Nontunable Structure Parameter
Use a nontunable structure parameter input to initialize a matrix output.
- 将总线连接到 MATLAB Function 模块
在 MATLAB Function 模块中使用结构体。
- 将大型结构体作为输入参数传递
为了避免内存问题,请按引用传递大型结构体。
- 为代码生成定义标量结构体
遵守针对标量结构体的代码生成限制。
- 为代码生成定义结构体数组
遵循针对结构体数组的代码生成限制。
- 用于代码生成的结构体定义
在用于进行代码生成的 MATLAB® 代码中使用结构体。
- 代码生成允许的结构体操作
使用代码生成支持的结构体操作。