主要内容

本页翻译不是最新的。点击此处可查看最新英文版本。

MATLAB 类

R2026a
MATLAB® 类的仿真和代码生成

您可以在 MATLAB Function 模块中使用 MATLAB 类,包括值类、句柄类和 System object。要了解有关 MATLAB 中值和句柄类的更多信息,请参阅句柄类和值类的比较。要了解有关 System object 的更多信息,请参阅何谓 System object?。

在 MATLAB Function 模块中使用类时,您必须注意某些用法说明和限制。

模块

MATLAB Function block icon.MATLAB Function在 Simulink 模型中包含 MATLAB 代码
MATLAB System blockMATLAB System在模型中包含 System object

主题

疑难解答

Resolve Error: Handle Object Referenced by Persistent Variable (MATLAB Coder)

Troubleshoot error when using a persistent handle object.

Resolve Error: Nontunable Property Cannot Be Defined by Subscripted Assignment (MATLAB Coder)

Troubleshoot code generation failure when a System object uses a structure.

Resolve Error: Class Properties Must Be Fully Defined Before Use (MATLAB Coder)

Troubleshoot code generation error when class properties are not defined before use.

Resolve Error: Cannot Reference Handle Object Outside of Loop (MATLAB Coder)

Troubleshoot error when creating or allocating a handle object inside a for-loop.

类没有属性 (MATLAB Coder)

句柄类的属性赋值问题故障排除。

某些属性不支持按引用传递 (MATLAB Coder)

某些属性无法与 coder.ref、coder.rref 或 coder.wref 结合使用。

Resolve Error: coder.varsize Not Supported for Class Properties (MATLAB Coder)

Troubleshoot code generation error when using coder.varsize with properties of a MATLAB class.