| Stateflow User's Guide | ![]() |
Drawing States in Stateflow Diagrams
You program the control behavior for a Stateflow block in its Stateflow diagram. In Opening the Diagram for a Stateflow Block, you open the empty Stateflow diagram for the Controller Stateflow block. Now you need to graphically program it with its control behavior.
States are objects in a Stateflow diagram that represent modes of operation for a control device. In this example, a control device has two states of operation: on and off. Start programming the Stateflow diagram for the Controller block by drawing the states On and Off in the following steps:
The Stateflow diagram editor should now have the following appearance:
Stateflow diagrams are a form of a finite state machine. Finite state machines use states to represent the possible control modes of an object. You have just created two states named On and Off. These two states represent the two control modes for a single-speed fan: on and off. But they can also represent the control modes of a host of other devices that can be on or off, such as a light switch, a heater, and so on.
| Opening the Diagram for a Stateflow Block | Drawing Transitions in a Stateflow Diagram | ![]() |
© 1994-2005 The MathWorks, Inc.