| Stateflow User's Guide | ![]() |
Adding State Entry Actions
You modify data in Stateflow with actions. Actions are programming lines that you add to states or transitions in Stateflow diagrams. In this topic, you use state entry actions to change a data value that provides control information to the Simulink model. For now, assume that your diagram defines a data named speed that you pass to the Simulink model. You add a state entry action to modify the value of speed to indicate the speed of a device (for example, a motor) that you are controlling to the Simulink model.
Add entry actions to the labels of the states On and Off to modify the data speed with the following steps:
On.
The label for the On state now includes a name for the state (On) and an entry action, which is identified by the prefix en:. This entry action assigns the data speed a value of 1 when the state On becomes active.
| Modifying Output Data with Actions | Adding Output Data to the Stateflow Chart | ![]() |
© 1994-2005 The MathWorks, Inc.