| Stateflow User's Guide | ![]() |
Using Data and Event Arguments in Actions
When you use data and event objects as arguments to functions that you call in action language, they are assumed to be defined at the same level in the hierarchy as the action language that references them. If they are not found at that level, Stateflow attempts to resolve the object name by searching up the hierarchy. Data or event object arguments that are parented anywhere else must have their path hierarchies defined explicitly.
In the following example, state A calls the graphical function addit to add the Stateflow data x and y and store the result in data z.
The following Model Explorer windows show the data z is defined for state A, but the data x and y are defined for state AA, a substate of A.
The call to function addit from state A can resolve z because it is owned by A. However, it cannot resolve x and y by looking above state A. Therefore, the function call must reference x and y explicitly to their owner, state AA.
There are a variety of functions that you can call in Stateflow action language that use data as arguments. See the following sections:
Only the temporal logic operators take events as an argument. See Using Temporal Logic in Actions.
| Inferring Return Size for ml Expressions | Using Arrays in Actions | ![]() |
© 1994-2005 The MathWorks, Inc.