Documentation

Enumerated Constant

Generate enumerated constant value

  • Library:
  • Simulink / Sources

    HDL Coder / Sources

Description

TheEnumerated Constantblock outputs a scalar, array, or matrix of enumerated values. You can also use theConstantblock to output enumerated values, but it provides block parameters that do not apply to enumerated types, such asOutput minimumandOutput maximum. When you need a block that outputs only constant enumerated values, useEnumerated Constantrather thanConstant. For more information, seeSimulink Enumerations.

Ports

Output

expand all

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

Data Types:enumerated

Parameters

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 enterEnum:ClassNamein theOutput data typefield, whereClassNameis the name of the MATLAB®class that defines the type.

Programmatic Use

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

Select the category of data to specify.

Enumerated

Enumerated data types. SelectingEnumerated使第二个菜单/文本框右边,哪里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 theValueparameter. 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 theOutput data type. To specify an array that includes every value in the enumerated type, use theenumerationfunction.

Programmatic Use

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

Specify the interval between times that the block output can change during simulation (for example, due to tuning theValueparameter). The default value ofinfindicates that the block output can never change. A sample time ofinfspeeds the simulation and generated code by avoiding the need to recompute the block output. For more information, seeSpecify Sample Time.

Programmatic Use

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

Block Characteristics

Data Types

enumerated

Direct Feedthrough

no

Multidimensional Signals

yes

Variable-Size Signals

no

Zero-Crossing Detection

no

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