View State Activity by Using the Simulation Data Inspector

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

  • Data from your chart

  • Leaf chart activity

  • Child chart activity

  • Child state activity

  • Self state activity

  • Leaf state activity

Log to the Simulation Data Inspector from Stateflow

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

To log a signal with the Simulation Data Inspector, highlight the signal line that you want to log. Right-click the gear signal and choose Log Selected Signals from the context menu. A logging badge appears next to the gear signal, indicating that the data from that signal is logged when the model is run.

The logging badge marks logged signals in the model.

To log the active state data from gear_state:

  1. Open the Stateflow chart.

  2. To select gear_state, click gear_state.

  3. On the Simulink Editor toolbar, in the Simulation tab, click Log Child Activity.

After running one or more simulations with signals marked for logging, click Simulation Data Inspector button on the Simulink editor toolbar and view your data. Multiple runs show up in the Inspect pane and can be viewed together. To choose which signals you want to plot, use the check boxes next to the signal names.

Related Topics