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
matlab:open_system(docpath(fullfile(docroot, 'toolbox', 'sldrt', 'examples', 'sldrtex_model')))).
Make sure that you have started the Simulink® Desktop Real-Time™ kernel.
On the toolbar, set the simulation stop time to, for example,
Click Simulation > Mode > External.
In the model, select the signals
Signal Generator and
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.
To start the simulation, click the Run button. The Simulation Data Inspector button glows, indicating that Simulation Data Inspector has data available for viewing.
Click the Simulation Data Inspector button.
In Simulation Data Inspector, select the signals
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
12. To save the Simulation Data Inspector session as a
.mat file, click Save.