Main Content

State Transition Table Operations

A state transition table represents a finite state machine for sequential modal logic in tabular format. Instead of drawing states and transitions in a Stateflow® chart, you can use a state transition table to model a state machine in a concise, compact format that requires minimal maintenance of graphical objects. For more information, see State Transition Tables in Stateflow.

In the Stateflow Editor, you can insert, edit, and move rows and columns. You can also add history junctions and set the default state for the state transition table.

Insert Rows and Columns

To insert a row:

  1. Select an existing state.

  2. In the Modeling tab, select one of these options:

    • Insert State Row — Insert a state at the same level of hierarchy.

    • Insert Child State Row — Insert a state as a child of the selected state.

    • Insert Default Transition Path Row — Insert a row for specifying conditional default transition paths.

    • Insert Inner Transition Path Row — Inserts a row for specifying inner transitions from the selected parent state to its child states. This row type can only be added to states with children states.

To insert a column, in the Modeling tab, select Append Transition. A new else-if column appears to the right of the last column.

Move Rows and Transition Cells

To move a row, click the state cell and drag the row to a new location. As you drag the row, you see a visual indicator of where in the hierarchy the state will appear in its new position.

To move a transition cell, click anywhere in the cell and drag the condition, action, and destination cells as a unit to a new location. The transition cell you displace moves one cell to the right. If column does not exist, Stateflow creates one. The state transition table prevents you from moving cells to an invalid destination and alerts you to the problem.

Copy Rows and Transition Cells

To copy a row:

  1. Right-click the state in the row you want to copy and select Copy.

  2. Right-click the state in the destination row and select Paste.

    The row appears above the destination row.

To copy a transition cell:

  1. Right-click a cell and select Copy.

  2. Right-click a destination cell of the same type and select Paste.

    The new content overwrites the existing content at the destination. The state transition table prevents you from copying content to an invalid destination.

Set Default State

Select a state and, in the Modeling tab, select Set to default.

Add History Junction

You can add history junctions to states that have children. Select the state and, in the Modeling tab, select Add history junction.

Print State Transition Tables

To print a copy of the state transition table, press Ctrl+P (Command+P).

Select and Clear Table Elements

TaskAction
Select a cell for editingClick the cell.
Exit edit mode in a cellPress Esc or click another table, cell, row, or column.

Undo and Redo Edit Operations

To undo the effects of the previous operation, press Ctrl+Z (Command+Z).

To redo the effects of the previous operation, press Ctrl+Y (Command+Y).

You can undo and redo up to 10 operations.

Related Topics