There are several different approaches to stream signals to Simulation Data Inspector (SDI) from Speedgoat hardware running a real-time application. For more information about the streaming workflow, see Signal Logging and Streaming Basics .
(1) Using Signal Logging badges:
You can mark signals in your model for "permanent" logging to SDI using Log Signal badges:
NOTE: Every time you add or remove the Log Signal badge from a signal in your model, a rebuild of the real-time application is required for the change to take effect. To dynamically add/remove signals from SDI during the simulation, without having to rebuild the application, consider the other Instrument-based approaches (2)-(4) below.
(2) Using Instrument Buttons in Simulink Editor:
Starting in R2021b, when using the "Run on Target" button in your Simulink model to start your simulation in External Mode, you can add or remove signals for live streaming to SDI by using the Add/Configure/Remove Instrument buttons in the Simulink Editor:
(3) Using Simulink Real-Time Explorer:
When you use Simulink Real-Time Explorer to control your real-time application, you can select signals for streaming to SDI in the "Signals" panel. Click the Add Instrument and Remove Instrument (formerly "Start Streaming" and "Stop Streaming") buttons to add and remove the selected signals from SDI.
(4) Using Instrument Objects command-line interface:
Instrument objects provide a command-line interface for adding and removing signals in SDI. See the following code example:
>> inst = slrealtime.Instrument;
>> inst.addSignal('mysignal');
>> tg = slrealtime;
>> tg.addInstrument(inst);
>> tg.removeInstrument(inst);
>> tg.removeAllInstruments;
You can learn more about instrument objects here:
Note that Simulink Real-Time Explorer has a handy "Generate MATLAB code to create Instrument programmatically" button that will allow you to auto-generate the code needed to create your instrument object. Refer to the "Get MATLAB Code for Signals" section at:
Control streaming to SDI using Start/Stop Recording API:
As an overlay to all the options mentioned above, there is an additional Start/Stop Recording API (available from R2022a) that allows you globally control the streaming to SDI and create new runs while the simulation is running. See the following answer for more details: