coder.Constant class

Package: coder
Superclasses: coder.Type

Represent set containing one MATLAB value

Description

Use a coder.Constant object to define values that are constant during code generation. Use only with the fiaccel -args options. Do not pass as an input to a generated MEX function.

Construction

const_type=coder.Constant(v) creates a coder.Constant type from the value v.

const_type=coder.newtype('constant', v) creates a coder.Constant type from the value v.

Input Arguments

v

Constant value used to construct the type.

Properties

Value

The actual value of the constant.

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects.

Examples

Create a constant with value 42.

k = coder.Constant(42);

Create a new constant type for use in code generation.

k = coder.newtype('constant', 42);

Limitations

  • You cannot use coder.Constant on sparse matrices, or on structures, cell arrays, or classes that contain sparse matrices.

Introduced in R2011a