coder.ClassType Class
Namespace: coder
Superclasses: coder.ArrayType
Represent set of MATLAB classes acceptable for input specification
Description
Objects of the coder.ClassType
specify value class objects that the
generated code accepts. Use objects of this class only with the -args
option of the fiaccel
function. Do not pass as an input to a
generated MEX function.
Creation
creates a t
= coder.typeof(classObject
)coder.ClassType
object for
classObject
.
creates a t
= coder.newtype(className
)coder.ClassType
object for an object of the
className
class.
Note
You can create and edit coder.Type
objects interactively by using
the Coder Type Editor. See Create and Edit Input Types by Using the Coder Type Editor.
Input Arguments
Properties
When you create a coder.ClassType
object
t
by passing a value class object v
to
coder.typeof
, t
has same as the
properties as v
with the Constant
attribute set to
false
.
Similarly, when you create a coder.ClassType
object
t
by passing the name of the value class object, v
to
coder.newtype
, t
has same as the
properties as v
with the Constant
attribute set to
false
.
Examples
Tips
After you create a
coder.ClassType
, you can modify the types of the properties. For example, modify the type of theprop1
andprop2
properties of an objectt
:t = coder.typeof(myClass) t.Properties.prop1 = coder.typeof(int16(2)); t.Properties.prop2 = coder.typeof([1 2 3]);
After you create a
coder.ClassType
object, you can add properties. For example, add thenewprop1
andnewprop2
properties of an objectt
:t = coder.typeof(myClass) t.Properties.newprop1 = coder.typeof(int8(2)); t.Properties.newprop2 = coder.typeof([1 2 3]);
When you generate code, the properties of the
coder.ClassType
object that you pass to thecodegen
function must be consistent with the properties in the class definition file. However, if the class definition file has properties that your code does not use, thecoder.ClassType
object does not have to include those properties. The code generator ignores properties that your code does not use.
Version History
Introduced in R2017a
See Also
coder.CellType
(MATLAB Coder) | coder.Type
| coder.PrimitiveType
| coder.EnumType
| coder.CellType
| coder.FiType
| coder.Constant
| coder.ArrayType
| coder.newtype
| coder.typeof
| coder.resize
| fiaccel