Control Chart Execution by Using Default Transitions
Default Transition in Exclusive (OR) Decomposition
This example shows a transition from an OR state to a superstate with exclusive (OR) decomposition, where a default transition to a substate is defined.

Initially, the chart is asleep. State A is active. Event
E_one occurs and awakens the chart, which processes the event
from the root down through the hierarchy:
The chart root checks to see if there is a valid transition as a result of
E_one. There is a valid transition from stateAto superstateB.State
Aexit actions (exitA()) execute and complete.State
Ais marked inactive.The transition action,
A, is executed and completed.State
Bis marked active.State
Bentry actions (entB()) execute and complete.State
Bdetects a valid default transition to stateB.B1.State
B.B1is marked active.State
B.B1entry actions (entB1()) execute and complete.The chart goes back to sleep.
This sequence completes the execution of this Stateflow® chart associated with event E_one when state
A is initially active.
Default Transition to a Junction
The following example shows the behavior of a default transition to a connective junction. The default transition to the junction is valid only when state B is first entered, not every time the chart wakes up.

For this example, initially, the chart is asleep. State B.B1 is
active. Condition [C_two] is true. An event occurs and awakens
the chart, which processes the event from the root down through the
hierarchy:
State
Bchecks to see if there is a valid transition as a result of any event. There is none.State
Bduringactions (durB()) execute and complete.State
B1checks to see if there is a valid transition as a result of any event. There is none.State
B1duringactions (durB1()) execute and complete.
This sequence completes the execution of this Stateflow chart associated with the occurrence of any event.
Default Transition and a History Junction
This example shows the behavior of a superstate with a default transition and a history junction.

Initially, the chart is asleep. State A is active. A history
junction records the fact that state B4 is the previously active
substate of superstate B. Event E_one occurs
and awakens the chart, which processes the event from the root down through the
hierarchy:
The chart root checks to see if there is a valid transition as a result of
E_one.There is a valid transition from state
Ato superstateB.State
Aexit actions (exitA()) execute and complete.State
Ais marked inactive.State
Bis marked active.State
Bentry actions (entB()) execute and complete.State
Buses the history junction to determine the substate destination of the transition into the superstate.The history junction indicates that substate
B.B4was the last active substate, which becomes the destination of the transition.State
B.B4is marked active.State
B.B4entry actions (entB4()) execute and complete.The chart goes back to sleep.
This sequence completes the execution of this Stateflow chart associated with event E_one.
Labeled Default Transitions
This example shows the use of a default transition with a label.

Initially, the chart is asleep. State A is active. Event
E_one occurs and awakens the chart, which processes the event
from the root down through the hierarchy:
The chart root checks to see if there is a valid transition as a result of
E_one.There is a valid transition from state
Ato superstateB. The transition is valid if eventE_oneorE_twooccurs.State
Aexit actions execute and complete (exitA()).State
Ais marked inactive.State
Bis marked active.State
Bentry actions execute and complete (entB()).State
Bdetects a valid default transition to stateB.B1. The default transition is valid as a result ofE_one.State
B.B1is marked active.State
B.B1entry actions execute and complete (entB1()).The chart goes back to sleep.
This sequence completes the execution of this Stateflow chart associated with event E_one when state
A is initially active.