| Stateflow User's Guide |
 |
Simulating a Subchart
In Converting a State to a Subchart, you edit a Stateflow diagram to turn the superstate On into a subchart and add substates to it. Observe the behavior of the subchart On and its substates during simulation of the Stateflow diagram in the SFcontrol7 model in the following steps:
- Start the simulation and change the value of the input data
temp to 90.
When simulation starts, the first temp event updates the diagram and the state Off is entered.
|

|
- Send an
on_switch event with the manual switch.
- Double-click the On state.
- This opens the subchart On to expose the activity of its child states.
- Change the input value for
temp to take the transitions between the states No, Lo, and Hi.
- Send an
off_switch event with the Manual Switch block.
The active substate On exits.
|

|
- Click the Up to Controller tool
.
The transition from the On state is taken to the Off state, and the Off state becomes active.
|

|
| Converting a State to a Subchart | | Controlling Objects with Parallel Superstates |  |
© 1994-2005 The MathWorks, Inc.