Add an Instrument to 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 example model and its related MAT file, in the MATLAB Command Window, type:openExample('slrealtime/SlrtCreateUpdateInstPanelForStateflowCarExample'); open_system('slrt_ex_sf_car'); load('slrt_ex_user_inputs.mat');
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.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.
Visualize Stateflow states by using the Simulation Data Inspector. For more information, see View Simulation Data in Simulation Data Inspector and View State Activity by Using the Simulation Data Inspector (Stateflow).