MATLAB 类
您可以在 MATLAB Function 模块中使用 MATLAB 类,包括值类、句柄类和 System object。要了解有关 MATLAB 中值和句柄类的更多信息,请参阅句柄类和值类的比较。要了解有关 System object 的更多信息,请参阅何谓 System object?。
在 MATLAB Function 模块中使用类时,您必须注意某些用法说明和限制。
模块
| MATLAB Function | 在 Simulink 模型中包含 MATLAB 代码 |
| MATLAB System | 在模型中包含 System object |
主题
- 用于代码生成的 MATLAB 类定义 (MATLAB Coder)
在用于进行代码生成的 MATLAB 代码中使用类。
- 为代码生成定义类属性 (MATLAB Coder)
- MATLAB 代码生成中的 System object (MATLAB Coder)
在 MATLAB 生成的代码中使用 System object 的特殊注意事项。
- 句柄类析构函数的代码生成 (MATLAB Coder)
在用于进行代码生成的 MATLAB 代码中使用句柄类析构函数。
- 为 MATLAB 值类生成代码 (MATLAB Coder)
在用于代码生成的 MATLAB 代码中使用值类。
- Generate Code for MATLAB Functions That Use Handle Classes (MATLAB Coder)
Use a handle class in MATLAB code intended for code generation.
- 为 MATLAB 句柄类和 System object 生成代码 (MATLAB Coder)
在用于代码生成的 MATLAB 代码中使用您的 System object™。
- Generate Code for MATLAB Functions That Use Singleton Classes (MATLAB Coder)
Use a singleton handle class in MATLAB code for code generation.
疑难解答
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.