Stateflow User's Guide Previous page   Next Page

Adding Data to the Data Dictionary

You can use either the Stateflow editor or Explorer to add data that is accessible only in a specific chart. You must use the Stateflow Explorer to add data that is accessible everywhere in a Stateflow chart or in a specific object such as a state.

Adding Data in the Stateflow Diagram Editor

If you add events in the Stateflow diagram editor, they are parented by the Stateflow diagram and are visible to all objects in the chart. To add an event in the Stateflow diagram editor, do the following:

  1. From the Add menu of the Stateflow editor, select Event.
  1. The Data properties dialog appears.

  1. In the resulting pop-up menu, select one of the following scopes for this data:
  1. Stateflow adds a default definition of the new event to the Stateflow data dictionary and displays the Data dialog box.

  1. Specify properties for the data specified in the Data dialog box.
  1. See Setting Data Properties in the Data Dialog for a description of the property fields of the Data dialog box.

Adding Data in the Model Explorer

If you add events in the Model Explorer, you can choose any Stateflow object to parent the new event. This event is visible to the parent object and all child objects of the parent. To add an event in the Model Explorer, do the following:

  1. Select Explore from the Stateflow editor's Tools menu.
  1. The Model Explorer opens.

    If no object is selected, the current diagram or subchart is highlighted in the Model Hierarchy pane of the Model Explorer. Otherwise, the selected object is highlighted. In the preceding example, state Off is selected in the Stateflow diagram myChart when the Model Explorer is called.

  1. Select the object (machine, chart, or state) in the object hierarchy pane where you want the new data to be visible.

  1. In the preceding example, the Stateflow chart myChart is selected to receive the new event.

  1. From the Add menu of the Model Explorer, select Data.
  1. Stateflow adds a default definition for the new data in the data dictionary and displays an entry row for the new data in the Explorer's Contents pane.

  1. Change the properties of the event in one of the following ways:

Previous page  Adding Data Defining Temporary Data Next page

© 1994-2005 The MathWorks, Inc.