Main Content

View State Activity by Using the Simulation Data Inspector

You can use the Simulation Data Inspector (Simulink) to view logged data for your Stateflow® chart. With the Simulation Data Inspector, you can view:

  • 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. 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.

  3. Select the state gear_state. Then, in the Simulation tab, click Log Child Activity to log which substates in gear_state are active or inactive at the end of each time step. The logging badge appears in the corner of the state.

  4. In the selection_state state, select the downshifting substate. Then, in the Simulation tab, click Log Self Activity. This selection logs whether downshifting is active or inactive at the end of each time step.

  5. 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 changes color to indicate that the Simulation Data Inspector has new simulation data.

  3. In the Simulation Data Inspector, click the Visualizations and layouts button . In the Grid section, change Rows to 3. 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)

Topics