Stateflow User's Guide Previous page   Next Page

Correcting the Run-Time Error

In Debugging the Stateflow Diagram, you step through a simulation of an example Stateflow diagram and find an error: the generation of the event Switch is driving the simulation and the simulation time is passing too quickly for the input data object Shift to have an effect.

Correct this error in the following steps:

  1. Choose Stop from the Simulation menu of the graphics editor.
  1. The Stateflow diagram editor is now writeable. The model might need to be completely rethought.

  1. Add the condition [t > 10.0] to the transition from Power_on to Power_off as shown.

  1. Now the transition from Power_on to Power_off is not taken until simulation time is greater than 10.0.

  1. In the Stateflow Debugging window, select Start to begin simulation again.
  2. Select Step repeatedly to observe the new behavior.

Previous page  Debugging the Stateflow Diagram Debugging State Inconsistencies Next page

© 1994-2005 The MathWorks, Inc.