| Using Stateflow | Search  Help Desk |
Labeling a Transition
A transition is characterized by its label. The label can consist of an event, a condition, a condition action, and/or a transition action. The ? character is the default transition label. Transition labels have this general format.event [condition]{condition_action}/transition_action
Replace, as appropriate, your names for event, condition, condition action, and transition action. Each part of the label is optional.
Example: Transition Label
This example shows the format of a transition label.
E, triggers the transition from On to Off, provided the condition, [off_count==0], is true.
Condition.
A condition is a Boolean expression to specify that a transition occurs given that the specified expression is true. Enclose the condition in square brackets. See the section titled "Conditions" for information on the condition notation.
In this example, the condition [off_count==0] must evaluate as true for the condition action to be executed and for transition from the source to the destination to be valid.
Condition Action.
The condition action is executed as soon as the condition, if specified, is evaluated as true and before the transition destination has been determined to be valid.
If the transition consists of multiple segments, the condition action is executed as soon as the condition, if specified, is evaluated as true and before the entire transition is determined as valid. Enclose the condition action in curly brackets. See the section titled "Action Language" for more information on the action language.
If no condition is specified, the implied condition is always evaluated as true.
In this example, if the condition [off_count==0] is true, the condition action, off_count++ is immediately executed.
Transition Action.
The transition action is executed after the transition destination has been determined to be valid provided the condition, if specified, is true. If the transition consists of multiple segments, the transition action is only executed when the entire transition path to the final destination is determined as valid. Precede the transition action with a backslash. See the section titled "Action Language" for more information on the action language.
In this example, if the condition [off_count==0] is true, and the destination state Off is valid, the transition action Light_off is executed.