Identify Data by Using Dot Notation - MATLAB & Simulink (original) (raw)

Main Content

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 substateaa of the state a. The state and transition actions use qualified data names to refer to this symbol.

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:

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:

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

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 stateaa, 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.

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

The search ends at the chart level with no match found foraa.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.

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

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

To avoid this error:

See Also

Topics