| Stateflow User's Guide | ![]() |
Moving and Resizing States
To move a state, do the following:
To resize a state, do the following:
Creating Substates and Superstates
A substate is a state that can be active only when another state, called its parent, is active. States that have substates are known as superstates. To create a substate, click the State tool and drag a new state into the state you want to be the superstate. Stateflow creates the substate in the specified parent state. You can nest states in this way to any depth. To change a substate's parentage, drag it from its current parent in the state diagram and drop it in its new parent.
| Note A parent state must be graphically large enough to accommodate all its substates. You might need to resize a parent state before dragging a new substate into it. You can bypass the need for a state of large graphical size by declaring a superstate to be a subchart. See Using Subcharts to Extend Charts for details. |
Grouping States
Grouping a state causes Stateflow to treat the state and its contents as a graphical unit. This simplifies editing a state diagram. For example, moving a grouped state moves all its substates as well.
To group a state, double-click the state or its border.
Stateflow thickens the grouped state's border and grays its contents to indicate that it is grouped.
You can also group a state by right-clicking it and then selecting Make Contents and then Grouped from the resulting shortcut menu.
You must ungroup a superstate to select objects within the superstate. To ungroup a state, double-click it or its border or select Ungrouped from the Make Contents shortcut menu.
| Creating a State | Specifying Substate Decomposition | ![]() |
© 1994-2005 The MathWorks, Inc.