MATLAB Examples

Inspect Simulink® Desktop Real-Time™ Signals with Simulation Data Inspector

This example shows how to use Simulation Data Inspector (SDI) to log signal data from the real-time application. Use Simulink® external mode to establish a communication channel between your Simulink® block diagram and your real-time application. Control which signals to display by selecting them in the model. You can log signal data from models referenced at arbitrary levels within a model hierarchy.

This example uses the model sldrtex_model (matlab:open_system(docpath(fullfile(docroot, 'toolbox', 'sldrt', 'examples', 'sldrtex_model')))).

Make sure that you have started the Simulink® Desktop Real-Time™ kernel.

  1. Open sldrtex_model.
  2. On the toolbar, set the simulation stop time to, for example, 30 seconds.
  3. Click Simulation > Mode > External.
  4. In the model, select the signals Signal Generator and Transfer Fcn.
  5. On the toolbar, click the arrow next to the Simulation Data Inspector button, and then select Log Selected Signals. A faint Simulation Data Inspector icon appears next to each signal.
  6. To start the simulation, click the Run button. The Simulation Data Inspector button glows, indicating that Simulation Data Inspector has data available for viewing.
  7. Click the Simulation Data Inspector button.
  8. In Simulation Data Inspector, select the signals SignalGenerator:1 and Transfer Fcn:1. Simulation Data Inspector displays plotted data.

10. To stop the simulation, click the Stop button.

11. After the simulation, use the toolbar buttons to explore the data. For example, to view the simulation between seconds 2 and 4, in Simulation Data Inspector, click the Zoom in Time button. Drag the cursor over the range from 2 to 4.

12. To save the Simulation Data Inspector session as a .mat file, click Save.