| Stateflow | ![]() |
Backtracking Behavior in Flow Graphs Example
This example shows the behavior of transitions with junctions that force back-tracking behavior in flow graphs.
Initially, state A is active and conditions c1, c2, and c3 are true:
c1 from state A to a connective junction.
c1 is true, therefore action a1 is executed.
c3 is true, therefore action a3 is executed.
c4 is not true, therefore control flow is back-tracked to state A.
A.
c2 from state A to a connective junction.
c2 is true, therefore action a2 is executed.
c3 is true, therefore action a3 is executed.
c4 is not true, therefore control flow is back-tracked to state A.
The preceding example shows the unanticipated behavior of executing both actions a1 and a2 and executing action a3 twice. To resolve this problem, consider the following.
In this example, the previous example is amended with two terminating junctions that allow flow to terminate if either c3 or c4 is not true. This leaves state A active without taking any unnecessary actions.
| Transitions from a Source to a Destination Based on a Common Event Example | Event Actions in a Superstate Example | ![]() |