This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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 (MATLAB).

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