Stateflow Previous page   Next Page

Stateflow Is a Finite State Machine

If you double-click the Stateflow block in the preceding Simulink model, its Stateflow diagram appears in the Stateflow diagram editor window.

Stateflow is an example of a finite state machine. A finite state machine reacts to events by changing states. The preceding example has two states: Power_on and Power_off. When you first turn the state machine on, this chart is set to execute a special transition called a default transition that points to the inital state, Power_off. This makes the Power_off state active. Later, when you change the manual switch in Simulink from Off to On, the model sends an event (on_switch) that makes the Off state transition to the On state. This makes the Off state inactive and and On state active.

You'll get a chance to see this for yourself when you build and simulate this model in Build a Stateflow Model.


Previous page  Stateflow Is Part of Simulink Stateflow Adds Flow Diagrams to the State Machine Next page

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS