Main Content

View State Activity by Using the Simulation Data Inspector

You can use the Simulation Data Inspector (Simulink) to log state activity and data for your Stateflow® chart. With the Simulation Data Inspector, you can view and compare:

  • Data from your chart

  • Child and leaf state activity for your chart

  • Self, child, and leaf state activity for your states

Add Signals and States for Logging

In this example, you use the Simulation Data Inspector to monitor the active state data for the Stateflow chart in the model sf_car.

  1. Open the model sf_car.

    openExample("sf_car")

    Model diagram for the sf_car model.

  2. In the Simulink® Editor, click the gear signal. Then, in the Simulation tab, select Log Signals.

    Logging badge on the output signal gear.

    The logging badge appears above the signal to indicate that the data from the signal is logged when you run the model.

  3. Open the shift_logic chart by clicking the arrow in the bottom-left corner of the block.

    Stateflow chart shift_logic in the model sf_car.

  4. Select the state gear_state. Then, in the Simulation tab, click Log Child Activity. The logging badge appears in the corner of the state.

  5. In the selection_state state, select the downshifting substate. Then, in the Simulation tab, click Log Self Activity.

  6. Repeat the previous step for the upshifting substate.

View Logged Output in Simulation Data Inspector

  1. Simulate the model.

  2. In the Simulation tab, under Review Results, select Data Inspector . When you simulate the model, the icon is highlighted to indicate that the Simulation Data Inspector has new simulation data.

  3. In the Simulation Data Inspector, under Visualizations and Layouts, select the four-plot grid layout. Then, in the Inspect pane, select a signal for each plot. For more information, see Inspect Simulation Data (Simulink).

    Simulation Data Inspector that shows the active child states during simulation.

See Also

(Simulink)

Related Topics