Contents

Simulink Enumeration Limitations

Enumerations and Scopes

When a Scope block displays an enumerated signal, the vertical axis displays the names of the enumerated values only if the scope was open during simulation. If you open the Scope block for the first time before any simulation has occurred, or between simulations, the block displays only numeric values. When simulation begins, enumerated names replace the numeric values, and thereafter appear whenever the Scope block is opened.

When a Floating Scope block displays multiple signals, the names of enumerated values appear on the Y axis only if all signals are of the same enumerated type. If the Floating Scope block displays more than one type of enumerated signal, or any numeric signal, no names appear, and any enumerated values are represented by their underlying integers.

Enumerated Types for Switch Blocks

The control input of a Switch block can be of any data type supported by Simulink® software. However, the u2 ~=0 mode is not supported for enumerations. If the control input has an enumeration, choose one of the following methods to specify the criteria for passing the first input:

  • Select u2 >= Threshold or u2 > Threshold and specify a threshold value of the same enumerated type as the control input.

  • Use a Relational Operator block to do the comparison and then feed the Boolean result of this comparison into the control port of the Switch block.

Nonsupport of Enumerations

The following limitations exist when using enumerated data types with Simulink:

  • Packages cannot contain enumeration class definitions.

  • The If Action block might support enumerations, but currently does not do so.

  • Generated code does not support logging enumerated data.

  • Custom Stateflow® targets do not support enumerated types.

  • HDL Coder™ does not support enumerations.

Was this topic helpful?