coder.ClassSignature
R2026bDescription
Note
Using a MATLAB® class as an entry point for code generation is a tech preview. This
feature is in active development and might change between the tech preview and the
general release. To enable the feature, enter
enableCodegenForEntryPointClasses at the command line before
launching the MATLAB
Coder™ app, calling the codegen function, or creating a coder.Type object. To provide feedback, email the
development team or participate
in a survey.
Use a coder.ClassSignature object to specify an entry-point class
for code generation.
To generate code for a class signature object, pass the object to the codegen command by using the -class option.
You can also use a coder.ClassSignature object as an input argument to an
entry-point function. Specify the class signature object as an input argument by using the
-args option of the codegen command. When you use a
class signature object as an input to an entry-point function, you must simultaneously specify
the class signature object as an entry-point class by using the -class
option.
The code generator only generates a stable interface for a method of an entry-point class
when you add the method specification to the coder.ClassSignature object. The
code generator can change or inline other methods of the entry-point class.
Creation
Syntax
Description
creates a classSig = coder.ClassSignature(classInstance)coder.ClassSignature object from an instance of a MATLAB class, classInstance.
creates a classSig = coder.ClassSignature(classType)coder.ClassSignature object from the coder.ClassType object classType.
Input Arguments
Output Arguments
Properties
Object Functions
addMethod | Add method specification to coder.ClassSignature object (Tech
Preview) |
Examples
Limitations
You cannot use
coder.Constantto directly assign a constant value to a property of a class signature object. To define a property of an entry-point class as a constant, use theConstantattribute in the MATLAB class definition. Alternatively, specify acoder.Constantvalue when you add the constructor method to the class signature object.If a property of an entry-point class is a handle class, that property must be private or protected.
You cannot use these types of classes as entry points:
Abstract classes
Classes contained in aggregate data types, such as structures, cells, and other classes
Classes that inherit from the
matlab.mixin.Copyableclass
Version History
Introduced in R2026a
See Also
addMethod | codegen | coder.FunctionSignature | coder.typeof