结构体
定义和支持的结构体操作
您可以将 MATLAB Function 和 MATLAB System 模块中的变量定义为结构体。
模块
| MATLAB Function | 在 Simulink 模型中包含 MATLAB 代码 |
| MATLAB System | 在模型中包含 System object |
函数
coder.cstructname | 在生成代码中命名 C 结构体类型 |
主题
- 在 MATLAB Function 模块中创建结构体
遵循创建结构体的规范。
- Initialize Matrix Using a Nontunable Structure Parameter
Use a nontunable structure parameter input to initialize a matrix output.
- 将总线连接到 MATLAB Function 模块
在 MATLAB Function 模块中使用结构体。
- 为代码生成定义标量结构体 (MATLAB Coder)
遵守针对标量结构体的代码生成限制。
- 为结构体数组生成代码 (MATLAB Coder)
此示例说明如何编写使用结构体数组的 MATLAB® 函数,以便于进行代码生成。