| Stateflow User's Guide | ![]() |
Adding a Trigger Event to the Stateflow Diagram
A Stateflow diagram updates (executes) only in response to an event that it receives from Simulink. In Drawing Transitions in a Stateflow Diagram you provide transitions for the On and Off states to alternately become active and inactive during execution of the Controller Stateflow diagram. Now you need to provide events to Stateflow to update the Stateflow diagram and power its transitions.
In this topic, you define trigger events for the example Stateflow diagram. There are other ways to send events that update Stateflow diagrams. For example, you can tell the Stateflow diagram to execute every time Simulink samples the model. However, trigger events give you the greatest individual control over individual events sent to a Stateflow diagram, and that makes them the best events for studying Stateflow behavior.
Use the following steps to define a trigger event for updating the Controller diagram:
By default, the name of the event is set to event in the Name field of the Event properties dialog.
The Stateflow block in Simulink now has a trigger port for the event event as shown.
| Drawing Transitions in a Stateflow Diagram | Sending a Trigger Event to the Stateflow Chart | ![]() |
© 1994-2005 The MathWorks, Inc.