Stateflow User's Guide Previous page   Next Page

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:

  1. If necessary, load the SFcontrol3 model you built in Adding a Sensor to the Model, and save it as SFcontrol4.
  2. Double-click on the Stateflow block Controller to open the Stateflow diagram as shown.

  3. Select the transition from the Off state to the On state by clicking it at any point in the transition.
  1. The transition and its label highlight to a different color. You can select any graphical Stateflow object by clicking it.

  1. Press Delete.
  1. The transition disappears as shown.

    Continue altering the Stateflow diagram by copying and renaming states in the following steps.

  1. 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.

  2. Click on either line of the label for the top On state to place a cursor in it.
  3. Rename the top On state to the Hi state with the following label:
  1. The On state becomes the Hi state. When Hi becomes active, its entry action changes the value of the data speed to 2.

  1. Rename the bottom On state as follows:
  1. 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:


Previous page  Adding a Junction for Flow Control Adding and Connecting Junctions Next page

© 1994-2005 The MathWorks, Inc.