Skip to Main Content Skip to Search
Product Documentation

Using Dot Notation to Identify Data in a Chart

What Is Dot Notation?

Dot notation is a way to identify data at a specific level of the Stateflow chart hierarchy. For example, you can use dot notation for data identifiers in state actions and transitions.

In this chart, data resides in the state aa. Identifiers in state actions and transitions use dot notation to refer to this data.

Resolution of Data Identifiers with Dot Notation

During simulation, the chart searches for data that matches the identifier with dot notation. These rules apply:

Process for Resolving Data Identifiers with Dot Notation

The flow chart describes the following search process.

StageAction
1

The search begins at the level of the hierarchy where the identifier appears.

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

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

2

The chart searches at that level of the hierarchy for a path to the data. If the chart finds a match, it adds that path to the list of possible matches.

3

The chart moves up to the next highest level of the hierarchy. At that level, the chart searches for a path to the data. If the chart finds a match, it adds that path to the list of possible matches.

4

The previous step repeats until the search reaches the chart level.

5

At the chart level, one more search occurs for a path to the data. If a match exists, that path becomes part of the list of possible matches. Then, the search ends.

6

After the search ends, one of the following occurs:

  • If a unique match exists, the statement containing the data identifier executes.

  • If multiple matches exist, the chart sorts them in this order of priority:

    1. Local data in a state, subchart, or function

    2. Field name of a bus object (see Working with Structures and Bus Signals in Stateflow Charts)

    3. Value of an enumerated data type (see Using Enumerated Data in Stateflow Charts)

    The statement containing the data identifier executes using the match of highest priority.

  • If no matches exist, an error message appears.

Best Practices for Using Dot Notation in Data Identifiers

These examples show how to avoid problems when using dot notation in data identifiers.

Use a Specific Path in the Identifier

Be specific when defining the path to the data.

Suppose that state aa contains data. In state b, the entry action contains the aa.data identifier that the chart cannot resolve. This search process occurs:

StageActionFinds a Match?
1Chooses state b as the starting point and searches at that level for an object aa that contains data.No
2Moves up to the next level of the hierarchy and searches at the chart level for an object aa that contains data.No

The search ends, and an error message appears because no match exists for the aa.data identifier.

To avoid this message, use a specific path in the identifier for the entry action in state b:

en: a.aa.data+=1;

Use Unique State Names

Use unique names when you name the states in a chart.

Suppose that both states named aa contain a data object named data. In state a, the entry action contains two aa.data identifiers that the chart cannot resolve. This search process occurs:

StageActionFinds a Match?
1Chooses state a as the starting point and searches at that level for an object aa that contains data.Yes
2Moves up to the next level of the hierarchy and searches at the chart level for an object aa that contains data.Yes

The search ends, and a warning message appears because multiple matches of equal priority exist for the aa.data identifiers.

To avoid this message, perform one of these corrective actions:

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS