Simulink Constructs that Support Enumerations


In general, all Simulink® tools and constructs support enumerated types for which the support makes sense given the purpose of enumerated types: to represent program states and to control program logic. The Simulink Editor, Simulink Debugger, Port Value Displays, referenced models, subsystems, masks, buses, data logging, and most other Simulink capabilities support enumerated types without imposing any special requirements.

Enumerated types are not intended for mathematical computation, so no block that computes a numeric output (as distinct from passing a numeric input through to the output) supports enumerated types. Thus an enumerated type is not considered to be a numeric type, even though an enumerated value has an underlying integer. See Enumerated Values in Computation for more information.

Most capabilities that do not support enumerated types obviously could not support them. Therefore, the Simulink documentation usually mentions enumerated type nonsupport only where necessary to prevent a misconception or describe an exception. See Simulink Enumeration Limitations for information about certain constructs that could support enumerated types but do not.

Block Support

The following Simulink blocks support enumerated types:

All members of the following categories of Simulink blocks support enumerated types:

Many Simulink blocks in addition to those named above support enumerated types, but they either belong to one of the categories listed above, or are rarely used with enumerated types. The Data Type Support section of each block reference page describes all data types that the block supports.

Class Support

The following Simulink classes support enumerated types:

  • Simulink.Signal

  • Simulink.Parameter

  • Simulink.AliasType

  • Simulink.BusElement

Logging Enumerated Data

Root-level outports, To Workspace blocks, and Scope blocks can all export enumerated values. Signal and State logging work with enumerated data in the same way as with any other data. All logging formats are supported. The From File block does not support enumerated data. Use the From Workspace block instead, combined with some technique for transferring data between a file and a workspace. See Export Runtime Information for more information.

Importing Enumerated Data

Root-level inports and From Workspace blocks can output enumerated signals during simulation. Data must be provided in a Structure, Structure with Time, or TimeSeries object. No interpolation occurs for enumerated values between the specified simulation times. From File blocks produce only data of type double, so they do not support enumerated types. See Import Data for more information.

Was this topic helpful?