MATLAB 类
MATLAB® 类的代码生成
您可以为 MATLAB 类生成代码,包括值类、句柄类和 System object。在生成的 C 代码中,MATLAB 类表示为结构体。如果您生成 C++ 代码,代码生成器的默认行为是为 MATLAB 类生成 C++ 类。在用于代码生成的 MATLAB 代码中使用类时,您必须了解一些特定的用法说明和限制。
类
coder.ClassType | Represent set of MATLAB classes acceptable for input specification |
主题
代码生成基础知识
- 为 MATLAB 值类生成代码
在用于代码生成的 MATLAB 代码中使用值类。 - 为 MATLAB 句柄类和 System object 生成代码
在用于代码生成的 MATLAB 代码中使用您的 System object™。 - Generate C++ Classes for MATLAB Classes
Generate a C++ class for a value class, handle class, or System object in your MATLAB code.
输入设定
- Specify Value Class Objects as Inputs
Specify that an entry-point input is an object of a value class. - Define Types of Entry-Point Inputs by Using the MATLAB Coder App
Specify the types of entry-point function inputs using the MATLAB Coder™ app.
用法说明和限制
- 用于代码生成的 MATLAB 类定义
在用于进行代码生成的 MATLAB 代码中使用类。 - 支持代码生成的类
为 MATLAB 值以及句柄类和用户定义的 System object 生成代码。 - MATLAB 代码生成中的 System object
在 MATLAB 生成的代码中使用 System object 的特殊注意事项。 - 句柄类析构函数的代码生成
在用于进行代码生成的 MATLAB 代码中使用句柄类析构函数。
疑难解答
遵守针对句柄对象的代码生成限制。
句柄类的属性赋值问题故障排除。
某些属性无法与 coder.ref、coder.rref 或 coder.wref 结合使用。
Resolve Error: Code Generator Failed to Produce C++ Destructor for MATLAB Class
Troubleshoot generation of standalone code for C++ destructor of a MATLAB class.
对 MATLAB 代码中对象数组的代码生成失败进行故障排除。
