Main Content

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.

  1. 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');
  2. To make Stateflow states available in the Simulation Data Inspector, select them and mark them for Log Self Activity.

  3. Open the slrt_ex_sf_car model.

  4. Double-click the shift_logic chart.

    The shift_logic Stateflow chart in the slrt_ex_sf_car model controls the car transmission.

  5. In the gear_state chart, select the first state

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

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

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

  9. 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).

Related Topics