State Transition Table Operations
A state transition table is an alternative way of expressing sequential modal logic. Instead of drawing states and transitions graphically in a Stateflow® chart, use state transition tables to express the modal logic in tabular format. State transition tables are supported only as blocks in a Simulink® model. For more information, see State Transition Tables in Stateflow.
To create state transition tables, use 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:
Select an existing state.
In the Modeling tab, select one of the following options:
Option Description Insert State Row Inserts a state at the same level of hierarchy. Insert Child State Row Inserts a state as a child of the selected state. Insert Default Transition Path Row Inserts 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, click Append Transition Col. A new
else-ifcolumn appears to the right of the last column.
Move Rows and 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:
Right-click the state in the row you want to copy and select Copy.
Right-click the state in the destination row and select Paste.
The row appears above the destination row.
To copy a transition cell:
Right-click a cell and select Copy.
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
Right-click the state and select Set to default.
Add History Junction
You can add history junctions to states that have children. Right-click the state and 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
|Select a cell for editing||Click the cell.|
|Exit edit mode in a cell||Press 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.