MATLAB Classes
You can generate code for MATLAB classes, including value classes, handle classes, and System object™. Your class can have multiple methods and properties and can inherit from multiple classes. MATLAB classes are converted to C++ classes in the generated HLS code.
Topics
Code Generation Basics
- Generate HLS Code for MATLAB Value Classes
Use a value class in MATLAB code intended for HLS code generation. - Generate HLS Code for MATLAB Handle Classes and System Objects
Use a 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.
Usage Notes and Limitations
- Class Limitations for Code Generation
Adhere to code generation restrictions when you use classes in MATLAB code for code generation. - Define Class Properties for Code Generation
Define the properties of value and handle classes in MATLAB code for code generation. - System Object Considerations for HLS Code Generation
Special considerations for using System object in code generated from MATLAB. - Code Generation for Handle Class Destructors
Use a handle class destructor in MATLAB code intended for code generation.
Troubleshooting
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: Handle Object Referenced by Persistent Variable
Troubleshoot error when using a persistent handle object.
Resolve Error: Nontunable Property Cannot Be Defined by Subscripted Assignment
Troubleshoot code generation failure when a System object uses a structure.
Resolve Error: Class Properties Must Be Fully Defined Before Use
Troubleshoot code generation error when class properties are not defined before use.
Resolve Error: Cannot Reference Handle Object Outside of Loop
Troubleshoot error when creating or allocating a handle object inside a
for-loop.
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 Generation Does Not Support String and Object Arrays
Troubleshoot error when you use an object or string array in your MATLAB code.