Manage Data, Events, and Messages in the Symbols Pane

In the Symbols pane, you can view and manage data, events, and messages while working in the Stateflow® Editor. In the Modeling tab, select Symbols Pane.

From the Symbols pane you can:

  • Add and delete data, events, and messages.

  • Set the object type and scope.

  • Change the port number.

  • Edit the name of an object and update all instances of the object name in the chart.

  • Undo and redo changes in type, name, and port number.

  • Detect unused objects.

  • Detect and fix unresolved objects.

  • Trace between objects in the window and where the objects are used in the chart.

  • View and edit object properties in the Property Inspector.

The rows in the Symbols pane display object hierarchy. Expand an object in the window to see data, events, and messages parented by that object. By default, all the nongraphical objects in a chart are listed in the window. To view only the objects that are used at the current level of hierarchy and below, select the icon. To search for specific symbols, type in the Filter search box .

Add and Modify Data, Events, and Messages

To add a nongraphical object to a Stateflow block, in the Symbols pane:

  1. Select one of these icons.

    ObjectIcon
    Data
    Event
    Message

  2. In the row for the new object, under TYPE, choose the object type.

  3. Edit the name of the object.

  4. For input and output objects, under PORT, choose a port number.

  5. To view the object in the Property Inspector, right-click the object and select Inspect.

  6. In the Property Inspector, modify the object properties.

After you add objects through the Symbols pane, the objects appear as unused until you reference them in your Stateflow design.

In the Symbols pane, you can modify the name, type, and port number of Stateflow objects. Edit the name of objects in the NAME field. When you rename an object, select Shift+Enter to rename all instances of the object throughout the state machine. To change the type or port number of an object, click the corresponding field and select from the available options. To delete an object from the state machine, right-click the object and select Delete.

Detect Unused Data in the Symbols Pane

The Symbols pane indicates unused data, messages, functions, and events with a yellow warning icon. To delete unused objects, right-click the object in the Symbols pane and select Delete. By removing objects that have no effect on simulation, you can reduce the size of your model. In this chart, after you add data, it first appears as unused. After you reference data in the chart, the warning sign disappears.

The following types of unused data are not detected:

  • Machine-parented data

  • Inputs and outputs of MATLAB® functions

  • Data of parameter scope in a chart that contains atomic subcharts

Trace Data, Events, and Messages

Stateflow provides traceability between the state machine and nongraphical symbols. When you select a symbol in the Symbols pane, Stateflow highlights sections of the chart that access that symbol. When you select an object in your chart, Stateflow highlights the symbols that the object uses.

To control when the objects and symbols are highlighted, select the preference button . A drop-down menu appears.

For Stateflow to highlight symbols in the Symbols pane that an object uses, select Highlight used symbols. For Stateflow to highlight objects in the chart that use an symbol, select Highlight uses on diagram. With Highlight uses on diagram you can choose to highlight:

  • All uses of the symbol in your chart.

  • Objects from where the symbol is read.

  • Objects to where the symbol is written.

For example, open the model sf_tetris2 and double-click the chart TetrisLogic. In the Symbols pane, when you select constant ARENA_HEIGHT, the states and functions that use ARENA_HEIGHT are highlighted. If the chart does not use an object, the symbol appears in the window with a yellow warning icon .

To see the uses of the constant ARENA_HEIGHT, open the function freeze.

You can also select a graphical object such as a state, transition, or function in the chart and view the symbols that the object uses. For example, in the chart TetrisLogic, expand the symbol MainArea in the Symbols pane. If you select the state FreezeShape in the chart, then the local data shape and the function freeze() are highlighted in the Symbols pane. This highlighting indicates that those objects are used inside the state FreezeShape.

When in debugging mode, the values of each data are displayed in the VALUE column of the Symbols pane. Stateflow updates the values periodically when the simulation is running. The value column highlights changes to data values as the changes occur. When the debugger is stopped at a breakpoint, you can update the initial value or change the value of a symbols in either the command prompt or the Symbols pane.

Data or MessageUpdate Initial ValueUpdate During Debugging
InputNoNo
OutputYesYes
ParameterNoNo
ConstantYesNo
Data Store MemoryNoYes
LocalYesYes

For bus elements, you can change the value of a symbols in either the command prompt or the Symbols pane.

Bus ElementUpdate Initial ValueUpdate During Debugging
InputNoNo
OutputNoYes
ParameterNoNo
ConstantNoNo
Data Store MemoryNoYes
LocalNoYes

In the Symbols pane multidimensional arrays appear as the data type and size of the array. If the array does not exceed more than 100 elements, hover over the symbol to view the elements. For arrays that contain more than 100 elements, view the elements by using the command prompt.

When simulation is paused, hover over messages in the canvas to view payloads in the queue. This is similar to the hover functionality on the canvas. For other non-scalar objects, the size and data type appear. To see these values, use the Watch window. See Inspect and Modify Data and Messages While Debugging and Track Data in the Watch List.

Symbols Pane Limitations

You cannot add the types of objects listed in the table via the Symbols pane. To add these types of objects, use the Model Explorer. As a best practice, avoid using machine-parented data.

ObjectVia Symbols PaneVisible in Symbols Pane
Data, events, and messages parented by a stateNoYes
Data, events, and messages inside a functionNoYes
Data and events parented by the state machineNoNo

Additional limitations:

  • When you modify the code in a MATLAB function, the changes are not updated in the Symbols pane until after you save the MATLAB function.

  • You cannot undo or redo changes to input and output for MATLAB functions.

  • You cannot recover deleted data, events, or messages from a state transition table.

  • You cannot undo scope changes to data parented by graphical functions, MATLAB functions, and truth tables.

  • You cannot undo renaming an object for truth tables.

  • When you delete data for objects contained in a Simulink based state, the object remains in your Simulink based state and the data symbol is shown as undefined in the Symbols pane.

Related Topics