Adding Events

What Is an Event?

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

When to Add Events

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

Types of Events

An explicit event is an event that you define and can have one of these scopes:

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

Visibility of Events

The visibility of events in the Stateflow hierarchy is as follows:

Event Defined InVisible To
Stateflow machineAll Stateflow charts in the model, along with their states and substates
Stateflow chartThe chart, along with all states and substates
StateThe state and all substates

Adding Events Using the Stateflow® Editor

In the Stateflow Editor, you can add events to your Stateflow chart. Follow these steps:

  1. In the Stateflow Editor, select Add > Event.

  2. In the resulting submenu, select the scope for the event.

    The Stateflow Editor adds a default definition of the new event to the Stateflow hierarchy, and the Event properties dialog box appears.

  3. Specify properties for the event in the Event properties dialog box, as described in Setting Event Properties in the Event Dialog.

Adding Events Using the Model Explorer

To add events using the Model Explorer, follow these steps:

  1. In the Stateflow Editor, select Tools > Explore.

    The Model Explorer appears.

  2. In the Model Explorer, select the object in the Stateflow hierarchy where you want the new event to be visible.

    The object you select becomes the parent of the event.

  3. Select Add > Event, or click the Add Event button:

    The Model Explorer adds a default definition for the new event in the hierarchy and displays an entry row for the new event in the Contents pane, as in this example.

  4. Change the properties of the event you add in one of these ways:

  


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