本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

结构体

定义和支持的结构体操作

模块

MATLAB FunctionMATLAB 代码包含在生成可嵌入式 C 代码的模型中
MATLAB System在模型中包含 System object

函数

coder.cstructname在生成代码中命名 C 结构体类型

示例和操作指南

在 MATLAB Function 模块中创建结构体

遵循创建结构体的规范。

Define and Use Structure Parameters

Use Ports and Data Manager to add a structure variable to a MATLAB Function block.

Define Scalar Structures for Code Generation

Adhere to code generation restrictions for scalar structures.

为代码生成定义结构体数组

遵循针对结构体数组的代码生成限制。

将总线信号连接到 MATLAB Function 模块

MATLAB Function 模块中使用结构体。

Initialize a 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 a MATLAB Function block.

Assign Values to Structures and Fields

Follow guidelines for assigning values to structures and fields in a MATLAB Function block.

Pass Large Structures as Input Parameters

To avoid memory issues, pass large structures by reference.

概念

用于代码生成的结构体定义

在用于进行代码生成的 MATLAB® 代码中使用结构体。

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 a MATLAB Function block to bus signals.

Rules for Defining Structures in MATLAB Function Blocks

Adhere to restrictions for using structures in a MATLAB Function block.

Limitations of Structures and Buses in MATLAB Function Blocks

Structures in MATLAB Function blocks support a subset of the operations available for MATLAB structures.