Trace or Log Data with the Simulation Data Inspector

With the Simulation Data Inspector and Simulink Real-Time, you can trace signal data with data logging in immediate mode or log signal data with data logging in buffered mode. In immediate mode, you view the output in real time as the application produces it. The application can produce more data than the target computer can transmit in real time to the development computer. Data accumulates in the network buffer, and, if the buffer fills up, the kernel drops data points.

To avoid dropped data points caused by network buffer overruns, you can use buffered logging mode. In buffered mode, the kernel stores data for the buffered signals in a file on the target computer. At the end of execution, it transmits it to the development computer. You can then view the most important signals immediately and view the buffered signals afterward.

Buffered logging mode supports decimation and conditional block execution semantics. Some examples are logging buffered data by enabling data logging for a signal inside a for-iterator, function-call, or enabled/triggered subsystem. For more information about the Simulation Data Inspector, see Simulation Data Inspector.

Set Up Model

  1. Open xpcosc.

  2. Right-click the Mux output signal and select Log Selected Signals.

  3. Right-click the Sum output signal and select Log Selected Signals.

  4. Right-click the Sum output badge () and select Properties.

    Select Logging Mode to Buffered.

Set Up the Simulation Data Inspector

  1. Open the Simulation Data Inspector ().

  2. Click the Layout button ().

  3. Select two horizontal displays.

View Simulation Data

  1. Build and download xpcosc.

  2. Start real-time execution.

  3. When the Simulation Data Inspector button glows , click the top display and select the Sum output signal.

    Click in the bottom display and select the Mux output signals.

  4. Stop real-time execution.

    When the Sum output appears, click Fit to View ().

  5. To zoom in on a time segment of interest, for example 10.0–10.1 s, click Zoom in Time () and use the mouse and mouse wheel.

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

Related Topics