coder.Constant Class
Namespace: coder
Superclasses: coder.Type
Specification of constant value for code generation
Description
Use a coder.Constant object to define input values
that are constant during code generation. Use this object with the fiaccel
-args and -globals options to specify the
properties of the input arguments and the global variables, respectively. Do not pass
it as an input to a generated MEX function.
You can use a coder.Constant object in place of a
coder.Type object to specify a given constant value in an
entry-point input or global variable.
Creation
const_type = coder.Constant( creates a
v)coder.Constant type from the value v.
const_type = coder.newtype('constant',
creates a v)coder.Constant type from the value
v.
Note
After you have created a coder.Constant object, you can create a
constant global variable g that has the value v by using the
codegen command: codegen -globals {'g',
coder.Constant(v)}.
Properties
Examples
Limitations
You cannot use
coder.Constanton sparse matrices, or on structures, cell arrays, or classes that contain sparse matrices.You cannot use
coder.Constanton dictionaries, dictionary keys, or dictionary values.
Version History
Introduced in R2011a