Adding Data

When to Add Data

Add data when you want to define data that is visible to a specific level of the Stateflow® hierarchy.

Where You Can Use Data

You can store and retrieve data that resides internally in the Stateflow workspace, and externally in the Simulink® model or application that embeds the Stateflow chart. Stateflow actions can reference internal and external data.

Adding Data Using the Stateflow® Editor

How to Add Data

To add data using the Stateflow Editor, follow these steps:

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

  2. In the pop-up menu, select a scope for the new data object.

    See Scope for a description of each type of scope.

    Selecting scope adds a default definition of the new data object to the Stateflow hierarchy and displays the Data properties dialog.

  3. Specify properties for the new data object in the Data properties dialog, as described in Setting Data Properties in the Data Dialog.

Visibility of Data You Add in the Stateflow® Editor

If you add data in the Stateflow Editor, that data is visible to all objects in the chart.

Adding Data Using the Model Explorer

How to Add Data

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

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

    The Model Explorer opens. If no object is selected, the current chart or subchart appears highlighted in the Model Hierarchy pane. Otherwise, the selected object appears highlighted.

  2. In the Model Hierarchy pane, select the object in the Stateflow hierarchy where you want the new data to be visible.

    The object you select becomes the parent of the data object.

  3. In the Model Explorer, select Add > Data, or click the Add Data button:

    This action adds a default definition for the data in the hierarchy, and the data definition appears in a new row in the Model Explorer Contents pane.

  4. Change the properties of the data, as described in Setting Data Properties in the Data Dialog.

Visibility of Data You Add in the Model Explorer

In the Model Explorer, you can add data that is visible at these levels in the Stateflow hierarchy:

Stateflow objects that can parent data in the model hierarchy appear in this diagram.

  


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