Main Content

Decide How to Visualize Simulation Data

Visualizing simulation data throughout the modeling process helps you understand and tune model behavior. Simulink® offers several complementary visualization tools you can use throughout the modeling process. Some visualization tools also offer the ability to save simulation data. Learn about each technique so you can choose the right tools to visualize your model data.

  • Simulation Data Inspector — View, analyze, and compare logged data throughout the modeling process.

  • Scope block, Floating Scope block, and Scope Viewer — Debug and analyze data using an environment and capabilities similar to a bench-top oscilloscope.

  • Dashboard blocks — Build an interactive interface to tune and monitor a model.

  • Port value displays — View instantaneous signal values while debugging.

  • Custom MATLAB® visualization — Write MATLAB code to visualize data.

Simulation Data Inspector

You can use the Simulation Data Inspector for most visualization tasks. The Simulation Data Inspector integrates with data logging in your model and works well for visualizing many signals throughout a model. Use comparisons in the Simulation Data Inspector to prototype, debug, tune, calibrate, and test your models. The Simulation Data Inspector supports:

  • Viewing signals during simulation

  • Logging, importing, and exporting data

  • Configurable subplot layouts and visualization settings

  • Viewing data using multiple visualization options, including maps and XY plots

  • Post-processing and data analysis using comparisons with tolerance values

  • Saving plots and data to share or archive results

To visualize simulation data using the Simulation Data Inspector, log data in the model. When you log signals and outputs, the logged data is automatically available in the Simulation Data Inspector during and after simulation. In the model Configuration Parameters, select Data Import/Export > Record logged workspace data in Simulation Data Inspector to make logged states and Simscape™ data available in the Simulation Data Inspector after simulation. When you want to view signals without logging the data, consider using a Scope block, the Floating Scope block, or a Scope Viewer.

Open the Simulation Data Inspector from Simulation > Data Inspector or by clicking a signal logging badge. When you open the Simulation Data Inspector by clicking the logging badge on a signal, the signal is automatically plotted.

For more information, see Simulation Data Inspector.

Scope Blocks and the Scope Viewer

Scope blocks, Floating Scope blocks, and the Scope Viewer visualize connected signals in a similar way as a bench-top oscilloscope. The scope blocks and Scope Viewer use the same interface to visualize and analyze connected signals. The interface is similar to other domain-specific tools, such as the Spectrum Analyzer (DSP System Toolbox) and Array Plot (DSP System Toolbox) blocks. Scope blocks are easy to add and connect in your model, and you do not need to log data in order to view signal data.

Scope blocks, Floating Scope blocks, and the Scope Viewer support:

  • Viewing signals during simulation, including rapid accelerator simulations.

  • Simple connection and accessibility for lightweight debugging.

  • Signal visualization without logging.

  • Optional signal logging.

  • Starting simulations from the visualization interface using playback controls.

  • Oscilloscope measurements, including cursors and triggers. Additional measurements are available when you have a Simscape or DSP System Toolbox™ license.

  • Configurable plots and display.

  • Configurable triggers to capture events.

Use the Scope block, the Floating Scope block, and the Scope Viewer for prototyping and lightweight debugging. For example, in the early stages of model development, you can connect a Scope block to a signal to quickly verify component behavior. By adding triggers, you can tune a specific peak or other artifact in a signal. A Scope block may or may not be permanent in your model.

When you need to view data for signals throughout a model hierarchy, consider using the Simulation Data Inspector, especially if you already log the signals you want to view.

For more information, see Scope Blocks and Scope Viewer Overview.

Dashboard Blocks

The Dashboard library includes control blocks you can use to tune variables and parameters in your model and visualization blocks you can use to view signal data. Use Dashboard blocks to view instantaneous signal data and build an interactive interface for your model.

You can use Dashboard block controls to modify the values of variables and tunable parameters in your model during simulation. Visualization Dashboard blocks are updated continuously throughout simulation. When you need to debug a model that uses Dashboard blocks, consider using simulation pacing or simulation stepping to slow the simulation so you can view the instantaneous signal values. You can also promote Dashboard blocks to one or more panels so the interactive dashboard can follow you throughout a model hierarchy as you design and debug your model. For more information, see:

The Dashboard Scope block provides a simple view of a signal over time. You can zoom, pan, and add cursors to a Dashboard Scope block through the context menu. For more debugging and analysis capabilities, use a Scope block or log data to the Simulation Data Inspector.

For more information about using Dashboard blocks, see Tune and Visualize Your Model with Dashboard Blocks.

Port Value Displays

You can enable port value displays to view a signal value at a given time point. Port value displays can supplement existing visualizations while prototyping and debugging models. For example, you can view signal values on port value displays as you step through a simulation while visualizing the temporal behavior using a Scope block. You can also use port value displays on their own to support debugging without adding any blocks to your model or logging data.

To display a signal value, right-click the signal and select Show Value Label of Selected Port.

When inspecting signal data by displaying the value on the port, consider using simulation pacing or stepping through the simulation. For more information, see Simulation Pacing and Step Through a Simulation.

For more information, see Display Port Values for Debugging.

Custom MATLAB Visualizations

When you log simulation data to the workspace or a file, you can write MATLAB code and scripts to create custom visualizations. You can log signals, outputs, and states in a model, and you can also enable data logging for signals connected to Scope Viewers, Floating Scope blocks and Scope blocks. For more information about logging data in your model, see Export Simulation Data.


When you post-process data using MATLAB code and scripts, you do not need to write custom MATLAB code to visualize the data. You can import the processed data into the Simulation Data Inspector for visualization alongside the logged data.

The visualization code you write can depend on the format of the logged data. By default, logging uses the Dataset format and produces a single simulation output. Logged data is returned to the workspace as a Simulink.SimulationOutput object that contains a Simulink.SimulationData.Dataset object for each type of logging used in the simulation. Each Dataset object contains Simulink.SimulationData.Signal objects that store the data for an individual signal as a timeseries object. For more information, see Data Format for Logged Simulation Data.

When you log a signal, you can visualize the signal during simulation using custom MATLAB code. For more information, see Access Data in a MATLAB Function During Simulation.

See Also

| | |

Related Topics