| Stateflow User's Guide |
 |
Deleting, Copying, and Renaming Stateflow Objects
Begin preparation of the Stateflow diagram for the SFcontrol3 model by removing a transition from it in the following steps:
- If necessary, load the
SFcontrol3 model you built in Adding a Sensor to the Model, and save it as SFcontrol4.
- Double-click on the Stateflow block Controller to open the Stateflow diagram as shown.

- Select the transition from the Off state to the On state by clicking it at any point in the transition.
- The transition and its label highlight to a different color. You can select any graphical Stateflow object by clicking it.
- Press Delete.
- The transition disappears as shown.

Continue altering the Stateflow diagram by copying and renaming states in the following steps.
- Right-click on any point in the On state and hold down the mouse key while you drag a copy of the On state to a position just below as shown.

- Click on either line of the label for the top On state to place a cursor in it.
- Rename the top On state to the Hi state with the following label:
- The On state becomes the Hi state. When Hi becomes active, its entry action changes the value of the data
speed to 2.
- Rename the bottom On state as follows:
- The state Lo represents a low speed state for the controlled device, such as a motor. When it becomes active, it changes the value of the data
speed to 1.
The Stateflow diagram should now have the following appearance:

| Adding a Junction for Flow Control | | Adding and Connecting Junctions |  |
© 1994-2005 The MathWorks, Inc.