结构体
结构体的代码生成
MATLAB® Coder™ 支持为结构体生成代码,但对于操作、标量结构体的值属性和结构体数组存在一些限制。您可以为标量结构体和结构体数组生成代码。请遵守对子结构体和字段进行索引和赋值的限制。在生成的代码中,结构体参数按引用或按值传递。
函数
coder.cstructname | 在生成代码中命名 C 结构体类型 |
主题
- 用于代码生成的结构体定义
在用于进行代码生成的 MATLAB 代码中使用结构体。
- 代码生成允许的结构体操作
使用代码生成支持的结构体操作。
- 为代码生成定义标量结构体
遵守针对标量结构体的代码生成限制。
- 为代码生成定义结构体数组
遵循针对结构体数组的代码生成限制。
- Index Substructures and Fields
Adhere to code generation restrictions for indexing substructures and fields.
- Assign Values to Structures and Fields
Adhere to code generation restrictions for assigning values to structures and fields.
- Pass Structure Arguments by Reference or by Value in Generated Code
Control whether structure arguments are passed by reference or by value.
- Name the C Structure Type to Use With a Global Structure Variable
Use
coder.cstructname
to define a type object for a global structure.