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.
To insert a row:
Select an existing state.
Select Chart > Insert Row > and choose one of these options:
|State Row||Inserts a state at the same level of hierarchy.|
|Child State Row||Inserts a state as a child of the selected state.|
|Default Transition Path Row||Inserts a row for specifying conditional default transition paths.|
|Inner Transition Path Row||Inserts a row for specifying inner transitions from the selected parent state to its child states.|
To insert a column:
Select Chart > Append
Transition Column. A new
appears to the right of the last column.
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.
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.
Right-click the state and select Set to default.
You can add history junctions to states that have children. Right-click the state and select Add history junction.
To print a copy of the state transition table, select File > Print > Print or press Ctrl+P (Command+P).
|Select a cell for editing||Click the cell.|
|Exit edit mode in a cell||Press Esc or click another table, cell, row, or column.|
To undo the effects of the previous operation, select Edit + Undo or press Ctrl+Z (Command+Z).
To redo the effects of the previous operation, select Edit + Redo or press Ctrl+Y (Command+Y).
You can undo and redo up to 10 operations.
To zoom in and out of your State Transition Table, select View > Zoom. You can add new rows to your State Transition Table at the zoom level that is consistent with your chart. When you save your model, the zoom level is saved.