specification of constant value for code generation -凯发k8网页登录
package: coder
superclasses:
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 codegen
-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.constant
on sparse matrices, or on structures, cell arrays, or classes that contain sparse matrices.
version history
introduced in r2011a