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.

Enumerated Constant

Generate enumerated constant value

  • Library:
  • Simulink / Sources


The Enumerated Constant block outputs a scalar, array, or matrix of enumerated values. You can also use the Constant block to output enumerated values, but it provides block parameters that do not apply to enumerated types, such as Output minimum and Output maximum. When you need a block that outputs only constant enumerated values, use Enumerated Constant rather than Constant. For more information, see Simulink Enumerations.



expand all

Enumerated constant value, specified as a scalar, vector, or matrix.

Data Types: enumerated


expand all

Specify the enumerated type from which you want the block to output one or more values. The initial value, Enum:SlDemoSign, is a dummy enumerated type that prevents a newly cloned block from causing an error. To specify the desired enumerated type, select it from the drop-down list or enter Enum:ClassName in the Output data type field, where ClassName is the name of the MATLAB® class that defines the type.

Programmatic Use

Block Parameter: OutDataTypeStr
Type: character vector
Values: 'Enum:<ClassName>'
Default: 'Enum: SlDemoSign'

Select the category of data to specify.


Enumerated data types. Selecting Enumerated enables a second menu/text box to the right, where you can enter the class name.

Specify the value or values that the block outputs. The output of the block has the same dimensions and elements as the Value parameter. The initial value, SlDemoSign.Positive, is a dummy enumerated value that prevents a newly cloned block from causing an error.

To specify the desired enumerated values, select from the drop-down list or enter any MATLAB expression that evaluates to the desired result, including an expression that uses tunable parameters. All specified values must be of the type indicated by the Output data type. To specify an array that includes every value in the enumerated type, use the enumeration function.

Programmatic Use

Block Parameter: Value
Type: character vector
Values: 'Enum:<ClassName.Value>'
Default: 'SlDemoSign.Positive'

Specify the interval between times that the block output can change during simulation (for example, due to tuning the Value parameter). The default value of inf indicates that the block output can never change. A sample time of inf speeds the simulation and generated code by avoiding the need to recompute the block output. For more information, see Specify Sample Time.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar | vector
Default: 'inf'

Block Characteristics

Data Types


Direct Feedthrough


Multidimensional Signals


Variable-Size Signals


Zero-Crossing Detection


Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Introduced in R2009b