Classi di MATLAB
È possibile generare codice per le classi di MATLAB, comprese le classi valore, le classi handle e i System object. Nel codice C generato, le classi di MATLAB sono rappresentate come strutture. Se si genera codice C++, il comportamento predefinito del generatore di codice è di produrre classi C++ per le classi di MATLAB. È necessario tenere presenti alcune note d'uso e limitazioni quando si utilizzano le classi nel codice MATLAB destinato alla generazione di codice.
Classi
coder.ClassType | Represent set of MATLAB classes acceptable for input specification |
Argomenti
Nozioni di base sulla generazione di codice
- Generate Code for MATLAB Functions That Use Value Classes
Use a value class in MATLAB code intended for code generation. - Generate Code for MATLAB Functions That Use System Objects
Use a System object™ in MATLAB code for code generation. - Generate C++ Code for MATLAB Classes
Generate a C++ class for a value class, handle class, or System object in your MATLAB code.
Specifiche di input
- 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.
Note d'uso e limitazioni
- Class Limitations for Code Generation
Adhere to code generation restrictions when you use classes in MATLAB code for code generation. - 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.
Risoluzione dei problemi
Resolve Error: Class Does Not Have Property
Troubleshoot issues when you assign a value to a property of a handle class that is returned by a method.
Resolve Error: Passing by Reference Not Supported for Some Properties
Troubleshoot error when you use certain types of 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.
Resolve Error: Code Generation Does Not Support String and Object Arrays
Troubleshoot error when you use an object or string array in your MATLAB code.
