State Transition Table

Represent modal logic in tabular format




Use this block when you want to represent modal logic in tabular format. The State Transition Table block uses only MATLAB® as the action language.

State Transition Table Editor

If you double-click the State Transition Table block in sflib, the State Transition Table Editor shows the default layout of state-to-state transitions.

Using the State Transition Table Editor, you can:

  • Add states and enter state actions

  • Add hierarchy among your states

  • Enter conditions and actions for state-to-state transitions

  • Specify default transitions, inner transitions, and self-loop transitions

  • Add input or output data and events

  • Set breakpoints for debugging

  • Run diagnostics to detect parser errors

  • View auto-generated content as you edit the table

For more information about the State Transition Table Editor, see State Transition Table Operations in the Stateflow documentation.

Adding Data and Events

You can add data and events from the State Transition Table Editor:

Inputs and outputs

Chart > Add Inputs & Outputs > Data Input from Simulink

Chart > Add Inputs & Outputs > Data Output to Simulink

You can add inputs from the model and outputs to the model.

Chart > Add Other Elements

You can add these types of data:

  • Local

  • Constant

  • Parameter

  • Data store memory

Input events

Chart > Add Inputs & Outputs > Event Input from Simulink

An input event causes a State Transition Table block to execute when a Simulink® control signal changes or through a Simulink block that outputs function-call events. You can use one of these input triggers:

  • Rising edge

  • Falling edge

  • Either rising or falling edge

  • Function call

Output events

Chart > Add Inputs & Outputs > Event Output to Simulink

A output event triggers a function call to a subsystem. You can use one of these output triggers:
  • Function call

  • Either rising or falling edge

For more information, see Create a Function-Call Subsystem


Data Type Support

The State Transition Table block accepts input signals of any data type that Simulink supports, including fixed-point and enumerated data types.


For a description of the block parameters, see the Subsystem block reference page.


Direct Feedthrough


Sample Time

Specified in the Sample time parameter

Scalar Expansion




Zero-Crossing Detection

Yes, if enabled for continuous-time systems

For more information, see When to Enable Zero-Crossing Detection.

Introduced in R2012b

Was this topic helpful?