Classi di MATLAB
È possibile utilizzare le classi di MATLAB, comprese le classi valore, le classi handle e i System object in un blocco MATLAB Function. Per saperne di più sulle classi valore e sulle classi handle in MATLAB, vedere Comparison of Handle and Value Classes. Per saperne di più sui System object, vedere What Are System Objects?.
È necessario tenere presente alcune note d'uso e limitazioni quando si utilizzano le classi in un blocco MATLAB Function.
Blocchi
| MATLAB Function | Include MATLAB code in Simulink models |
| MATLAB System | Include System object in model |
Argomenti
- Class Limitations for Code Generation (MATLAB Coder)
Adhere to code generation restrictions when you use classes in MATLAB code for code generation.
- Define Class Properties for Code Generation (MATLAB Coder)
Define the properties of value and handle classes in MATLAB code for code generation.
- System Objects in MATLAB Code Generation (MATLAB Coder)
Special considerations for using System objects in code generated from MATLAB.
- Code Generation for Handle Class Destructors (MATLAB Coder)
Use a handle class destructor in MATLAB code intended for code generation.
- Generate Code for MATLAB Functions That Use Value Classes (MATLAB Coder)
Use a value class in MATLAB code intended for code generation.
- Generate Code for MATLAB Functions That Use Handle Classes (MATLAB Coder)
Use a handle class in MATLAB code intended for code generation.
- Generate Code for MATLAB Functions That Use System Objects (MATLAB Coder)
Use a System object™ in MATLAB code for code generation.
- Generate Code for MATLAB Functions That Use Singleton Classes (MATLAB Coder)
Use a singleton handle class in MATLAB code for code generation.
Risoluzione dei problemi
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.
Resolve Error: Class Does Not Have Property (MATLAB Coder)
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 (MATLAB Coder)
Troubleshoot error when you use certain types of properties with
coder.ref, coder.rref, or
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.