Main Content

Identify Data by Using Dot Notation

To specify the path from the parent state to a data object, a qualified data name uses dot notation. Dot notation is a way to identify data at a specific level of the Stateflow® chart hierarchy. The first part of a qualified data name identifies the parent object. Subsequent parts identify the children along a hierarchical path.

For example, in this chart, the symbol data resides in the substate aa of the state a. The state and transition actions use qualified data names to refer to this symbol.

  • In the default transition, the action uses the qualified data name a.aa.data to specify a path from the chart to the top-level state a, to the substate aa, and finally to data.

  • In state a, the entry action uses the qualified data name aa.data to specify a path from the substate aa to data.

  • In state b, the entry action uses the qualified data name a.aa.data to specify a path from the chart to the state a, to the substate aa, and then to data.

Chart with two states named a and b. State a contains a substate named aa. State aa contains a data object named data.

Resolution of Qualified Data Names

During simulation, Stateflow resolves the qualified data name by performing a localized search of the chart hierarchy for a matching data object. The search begins at the hierarchy level where the qualified data name appears:

  • For a state action, the starting point is the state containing the action.

  • For a transition label, the starting point is the parent of the transition source.

The resolution process searches each level of the chart hierarchy for a path to the data. If a data object matches the path, the process adds that data object to the list of possible matches. Then, the process continues the search one level higher in the hierarchy. The resolution process stops after it searches the chart level of the hierarchy. If a unique match exists, the qualified data name resolves to the matching path. Otherwise, the resolution process fails. Simulation stops, and you see an error message.

This flow chart illustrates the different stages in the process for resolving qualified data names.

Flow chart that describes process for resolving qualified data names.

Best Practices for Using Dot Notation

Resolving qualified data names:

  • Does not perform an exhaustive search of all data.

  • Does not stop after finding the first match.

To improve the chances of finding a unique search result when resolving qualified data names:

  • Use specific paths in qualified data names.

  • Give states unique names.

  • Use states and boxes as enclosures to limit the scope of the path resolution search.

Examples of Qualified Data Name Resolution

Search Produces No Matches

In this chart, the entry action in state b contains the qualified data name aa.data. If the symbol data resides in state aa, then Stateflow cannot resolve the qualified data name.

Chart with two states named a and b. State a contains a substate named aa. State aa contains a data object named data.

This table lists the different stages in the resolution process for the qualified data name aa.data.

StageDescriptionResult
1Starting in state b, search for an object aa that contains data.No match found.
2Move up to the next level of the hierarchy (the chart level). Search for an object aa that contains data.No match found.

The search ends at the chart level with no match found for aa.data, resulting in an error.

To avoid this error, in the entry action of state b, specify the data with the more specific qualified data name a.aa.data.

Search Produces Multiple Matches

In this chart, the entry action in state a contains two instances of the qualified data name aa.data. If both states named aa contain a data object named data, then Stateflow cannot resolve the qualified data name.

Chart with three states named a, aa, and b. State a contains a substate named aa. Each of the states named aa contains a data object named data.

This table lists the different stages in the resolution process for the qualified data name aa.data.

StageDescriptionResult
1Starting in state a, search for an object aa that contains data.Match found.
2Move up to the next level of the hierarchy (the chart level). Search for an object aa that contains data.Match found.

The search ends at the chart level with two matches found for aa.data, resulting in an error.

To avoid this error:

  • Use a more specific qualified data name. For instance:

    • To specify the data object in the substate of state a, use the qualified data name a.aa.data.

    • To specify the data object in the top-level state aa, use the qualified data name /aa.data.

  • Rename one of the states containing data.

  • Enclose the top-level state aa in a box or in another state. Adding an enclosure prevents the search process from detecting data in the top-level state.

    Chart in which a box encloses the top-level state aa.

Related Topics