Clases de MATLAB
Puede generar código para clases de MATLAB, como clases de valores, clases de identificadores y System objects. En el código C generado, las clases de MATLAB se representan como estructuras. Si genera código C++, el comportamiento predeterminado del generador de código es producir clases de C++ para las clases de MATLAB. Debe tener en cuenta ciertas indicaciones y limitaciones de uso cuando utilice clases en el código de MATLAB destinado a la generación de código.
Clases
coder.ClassType | Represent set of MATLAB classes acceptable for input specification |
Temas
Conceptos básicos de la generación de código
- Generate Code for MATLAB Value Classes
Use a value class in MATLAB code intended for code generation. - Generate Code for MATLAB Handle Classes and System Objects
Use your System object™ in MATLAB code intended for code generation. - Generate C++ Classes for MATLAB Classes
Generate a C++ class for a value class, handle class, or System object in your MATLAB code.
Especificación de la entrada
- Specify Objects as Inputs at the Command Line
Specify that an entry-point input is an object of a value class by using thecodegen
-args
option. - Specify Objects as Inputs in the MATLAB Coder App
Define the type of a value class input from a test file or an example input.
Indicaciones y limitaciones de uso
- MATLAB Classes Definition for Code Generation
Use classes in MATLAB code intended for code generation. - Classes That Support Code Generation
Generate code for MATLAB value and handle classes and user-defined System objects. - System Objects in MATLAB Code Generation
Special considerations for using System objects in code generated from MATLAB. - Code Generation for Handle Class Destructors
Use a handle class destructor in MATLAB code intended for code generation.
Solución de problemas
Handle Object Limitations for Code Generation
Adhere to code generation restrictions for handle objects.
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.