Stateflow | ![]() ![]() |
Using Dot Notation with Properties and Methods
You can access the properties and methods of an object by adding a period (.
) and the name of the property or method to the end of an object's handle variable. For example, the following command returns the Type property for a State object represented by the handle s
:
The following command calls the dialog
method of the State object s
to open a properties dialog for that state:
Nesting Dot Notation
You can nest smaller dot expressions in larger dot expressions of properties. For example, the Chart
property of a State object returns the Chart object of the containing chart. Therefore, the expression s.Chart.Name
returns the name of the chart containing the State whose object is s
.
Methods can also be nested in dot expressions. For example, if the State object sA1
represents state A1 in the final Stateflow chart at the end of Create New Objects in the Chart, the following command returns the string label for state A1's inner transition to its state A11.
The preceding command uses the LabelString
property of a Transition object and the innerTransitions
method for a State object. It works as shown only because state A1 has one inner transition. If state A1 has more than one transition, you must first find all the inner transitions and then use an array index to access each one, as shown below:
innerTransitions = sA1.innerTransitionsOf label1 = innerTransitions(1).LabelString label2 = innerTransitions(2).LabelString and so on...
![]() | Naming Conventions for Properties and Methods | Using Function Notation with Methods | ![]() |