Main Content

Instrument a Stateflow Subsystem

A Simulink® Real-Time™ model that uses Stateflow® blocks can provide visual confirmation that your chart behaves as expected when you simulate the model or run the real-time application.

This procedure uses the model slrt_ex_sf_car. To open the model, in the MATLAB Command Window, type:

open_system(fullfile(matlabroot, 'toolbox', 'slrealtime', ...
'examples', 'slrt_ex_sf_car'))

To make Stateflow states available in the Simulation Data Inspector, select them and mark them for Log Self Activity.

Open the slrt_ex_sf_car model.

Double-click the shift_logic chart.

Image of slrt_ex_sf_car charl log of self activity

In the gear_state chart, select the first state

Click the Log Self Activity button and the Test Point button.

Repeat steps 3–4 for gear_state values second, third, and fourth.

Build and download the real-time application to the target computer. On the Real-Time tab, click Run on Target.

Monitor Stateflow states by using the Simulation Data Inspector. For more information, see View Data in the Simulation Data Inspector and View State Activity by Using the Simulation Data Inspector (Stateflow).

Related Topics