Stateflow |
 |
Exiting an Active State
A state is exited (becomes inactive) in one of the following ways:
- Its boundary is the origin of an outgoing executed transition.
- Its boundary is crossed by an outgoing executed transition.
- It is a parallel state child of an activated state.
A state performs its exit
action (if specified) before it becomes inactive. The state is marked inactive after the exit
action has executed and completed.
The execution steps for exiting a state are as follows:
- If this is a parallel state, and one of its sibling states was entered before this state, exit the siblings starting with the last-entered and progressing in reverse order to the first-entered. See step 2 of Entering a State.
- If there are any active children, perform the exit steps on these states in the reverse order they were entered.
- Perform any exit actions.
- Mark the state as inactive.
| Executing an Active State | | State Execution Example |  |