| Stateflow User's Guide | ![]() |
Exporting Events to Stateflow External Code
Stateflow allows a Stateflow machine to export events. Exporting events enables external code to trigger events in the Stateflow machine.
Exported events can be parented only by a Stateflow machine. To export an event, add the event to the Stateflow machine and set its Scope property to Exported.
| Note You must use the Model Explorer to add exported events to a Stateflow machine. For information on adding events in the Model Explorer, see Adding Events in the Model Explorer. |
The Stateflow code generator generates a function for each exported event. The C prototype for the exported event function has the form
where EVENT is the name of the exported event. External code built into a target can trigger the event by invoking the event function. For example, suppose you define an exported event named switch_on. External code can trigger this event by invoking the generated function external_broadcast_trigger_on. See Exported Events for an example of how to trigger an exported event.
See Exported Events for an example of a Stateflow event exported to Stateflow external code.
| Sharing Events with Stateflow External Code | Importing Events from Stateflow External Code | ![]() |
© 1994-2005 The MathWorks, Inc.