Main Content

MATLAB

MATLAB® 类的代码生成

您可以为 MATLAB 类生成代码,包括值类、句柄类和 System object。在生成的 C 代码中,MATLAB 类表示为结构体。如果您生成 C++ 代码,代码生成器的默认行为是为 MATLAB 类生成 C++ 类。在用于代码生成的 MATLAB 代码中使用类时,您必须了解一些特定的使用说明和限制。

coder.ClassTypeRepresent set of MATLAB classes acceptable for input specification

主题

代码生成基础知识

输入设定

使用说明和限制

疑难解答

Handle Object Limitations for Code Generation

Adhere to code generation restrictions for handle objects.

Class Does Not Have Property

Troubleshoot issues with assignment of a property of a handle class.

Passing By Reference Not Supported for Some Properties

You cannot use certain properties with coder.ref, coder.rref, or 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.

Work Around Language Limitation: Code Generation Does Not Support Object Arrays

Troubleshoot code generation failure for arrays of objects in your MATLAB code.