Products & Services Solutions Academia Support User Community Company

Learn more about Stateflow   

How Events Work in Stateflow Charts

What Is an Event?

An event is a Stateflow object that can trigger actions in one of these objects:

When to Use Events

Use events when you want to do one of the following:

Although Stateflow software does not limit the number of events you can use in a chart, the underlying C compiler enforces a theoretical limit of (2^31)-1 events for the generated code.

Types of Events

An explicit event is an event that you define and can have one of the following scopes.

ScopeDescription
LocalEvent that can occur anywhere in a Stateflow machine but is visible only in the parent object (and descendants of the parent). See Directed Event Broadcasting.
Input from SimulinkEvent that occurs in a Simulink block but is broadcast to a Stateflow chart. See Using Input Events to Activate a Stateflow Chart.
Output to SimulinkEvent that occurs in a Stateflow chart but is broadcast to a Simulink block. See Using Output Events to Activate a Simulink Block.

An implicit event is a built-in event that broadcasts automatically during chart execution (see Using Implicit Events).

Where You Can Use Events

You can define explicit events at these levels of the Stateflow hierarchy.

An event you define in a...Is visible to...
ChartThe chart and all states and substates
SubchartThe subchart and all states and substates
StateThe state and all substates

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS