Main Content

Execute Real-Time Application with MATLAB Language

Run the real-time application by using generated code to observe the real-time behavior of the model. This procedure uses the Simulink® model slrt_ex_osc_rt. To open the model, in the MATLAB Command Window, type:

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

You must have already completed the steps in Prepare Real-Time Application by Using MATLAB Language. In the model, select the output signal and mark the signal for data logging with the Simulation Data Inspector.

This example uses functions in the MATLAB Command Window to start and stop the real-time application. For more information, see Target object functions.

  1. Start the target computer.

  2. The target computer displays session 1 (default) and the target computer status monitor.

  3. Open the Simulation Data Inspector. In the MATLAB Command Window, type:

    Simulink.sdi.view
  4. Start the real-time application. In the MATLAB Command Window, type:

    start(tg)
  5. Observe that the real-time application starts running on the target computer. The status monitor displays information as the real-time application executes. The Simulation Data Inspector displays signal data.

    Image of slrt_ex_osc_rt output in the SDI

  6. Stop the real-time application. In the Command Window, type:

    stop(tg)
  7. To monitor the event status of the Target object, install a listener for object events.

To view the status monitor from the development computer, you can use PuTTY to open an SSH client and start the status monitor application /usr/target/bin/statusmonitor on the target computer.

For more information, see Target Computer Status Monitor.

See Also

| |

Related Topics