Stateflow User's Guide Previous page   Next Page

Labeling States

The label for a state specifies its required name for the state and the optional actions executed when the state is entered, exited, or receives an event while it is active.

State labels have the following general format.

The italicized entries in this format have the following meanings:

Keyword
Entry
Description
NA
name
A unique reference to the state with optional slash
entry or en
entry actions
Actions executed when a particular state is entered as the result of a transition taken to that state
during or du
during actions
Actions that are executed when a state receives an event while it is active with no valid transition away from the state
exit or ex
exit actions
Actions executed when a state is exited as the result of a transition taken away from the state
bind
events or data
Binds the specified events or data to this state. Bound data can only be changed by this state or its children, but can be read by other states. Bound events can be broadcast only by this state or its children.
on
event_name
and
on event_name actions
A specified event
and
Actions executed when a state is active and the specified event event_name occurs
See Adding Events for information on defining and using events.

Entering the Name

Initially, a state's label is empty. Stateflow indicates this by displaying a ? in the state's label position (upper left corner). Begin the labeling the state by entering a name for the state with the following steps:

  1. Click the state.
  1. The state turns to its highlight color and a question mark character appears in the upper left-hand corner of the state.

  1. Click the ? to edit the label.
  1. An editing cursor appears. You are now free to type a label.

    Enter the state's name in the first line of the state's label. Names are case sensitive. To avoid naming conflicts, do not assign the same name to sibling states. However, you can assign the same name to states that do not share the same parent.

    If you are finished labeling the state, click outside of the state. Otherwise, continue entering actions. To reedit the label, simply click the label text near the character position you want to edit.

Entering Actions

After entering the name of the state in the state's label, you can enter actions for any of the following action types:

You can also edit the state's label through the properties dialog for the state. See Changing State Properties.


Previous page  Changing State Properties Outputting State Activity to Simulink Next page

© 1994-2005 The MathWorks, Inc.