Documentation

Notation for Enumerated Values in Charts

Nonprefixed Notation for Enumerated Values

To minimize identifier length when referring to enumerated values in Stateflow® charts, you can use nonprefixed notation. This notation is a string of the form Name, where Name is the enumerated value name.

If your chart uses data types that contain identical enumerated names (such as Colors.Red and Temp.Red), consider using prefixed notation to prevent name conflicts among identifiers. For details, see Prefixed Notation for Enumerated Values.

Requirements for Using Nonprefixed Notation in Charts

The requirements for using nonprefixed notation are:

  • The enumerated data type definition must be in a file on the MATLAB® search path.

  • Enumerated data of this type exists in the chart. For more information, see Define Enumerated Data in a Chart.

Example of Nonprefixed Notation in Charts

Suppose that you have an identifier with nonprefixed notation: Red. The enumerated name Red belongs to the data type TrafficColors.

To use the nonprefixed notation Red, follow these requirements:

  • Define TrafficColors as an enumerated data type in a file on the MATLAB search path.

  • Define data of enumerated type TrafficColors in the chart.

Prefixed Notation for Enumerated Values

To prevent name conflicts when referring to enumerated values in charts, you can use prefixed notation. This notation is a string of the form Type.Name. Type is an enumerated data type and Name is the enumerated value name.

Suppose that you have three data types (Colors, Temp, and Code) that contain the enumerated name Red. By using prefixed notation, you can distinguish Colors.Red from Temp.Red and Code.Red.

Requirement for Using Prefixed Notation

The only requirement for using prefixed notation is that the enumerated data type definition is in a file on the MATLAB search path.

Example of Prefixed Notation

Suppose that you have an identifier with prefixed notation: TrafficColors.Red. The enumerated name Red belongs to the data type TrafficColors.

You can meet the requirement for prefixed notation by defining TrafficColors as an enumerated data type in a file on the MATLAB search path.

Was this topic helpful?