Stateflow    

Executing an Active State

Active states that receive an event that does not result in an exit from that state execute a during action to completion if a during action is specified for that state. An on event_name action executes to completion when the event specified, event_name, occurs and that state is active. An active state executes its during and on event_name actions before processing any of its children's valid transitions. During and on event_name actions are processed based on their order of appearance in the state label.

The execution steps for executing a state that receives an event while it is active are as follows:

  1. The set of outer flow graphs is executed (see Executing a Set of Flow Graphs).
  1. If this causes a state transition, execution of the state stops.

  1. During actions and valid on event name actions are preformed.
  2. The set of inner flow graphs is executed. If this does not cause a state transition, the active children are executed, starting at step 1. Parallel states are executed in the same order that they are entered.

  Entering a State Exiting an Active State