| Stateflow User's Guide | ![]() |
Adding Superstates to Simplify Control
You create a junction in Controlling with Junctions to choose between destination states in the following Stateflow diagram:
While this does give you more destination control states, it also adds more complexity to the Stateflow diagram. Instead of having one transition from the On state to the Off state, now you need transitions from both the Hi and Lo states to the Off state. In fact, for every control state that you add (for example, Medium, Medium-High, and so on), you need a transition back to the Off state.
To solve this problem, you create a superstate for the Hi and Lo states. Superstates can contain many states for a given state and give you the simplicity of only one exit point. In the following procedure topics, you create and test the On superstate that you add to contain the states Hi and Lo:
| Controlling with Superstates | Adding a Superstate | ![]() |
© 1994-2005 The MathWorks, Inc.