| Contents | Index |
The Simulation Data Inspector software provides the capability to inspect and compare time series data at several stages of your workflow:
Model design: Inspect and compare simulation data after making changes to the model diagram or its configuration.
Testing your model: Compare simulation data with different input data
Code generation: Compare simulation data and generated code output of your model
You can compare variable-step data, fixed-step solver data from Simulink and Simulink Coder, and fixed-step output with external data. How the Simulation Data Inspector Tool Aligns Signals describes how signals are aligned between runs. How the Simulation Data Inspector Tool Compares Time Series Data describes how aligned signal data are compared.
A typical workflow for inspecting and comparing signal data is:
Set up your model to log signal data, as in Exporting Signal Data Using Signal Logging.
Open the Simulation Data Inspector tool, as described in Open the Simulation Data Inspector Tool.
Simulate your model and record simulation data or import logged signal data, as described in Record or Import Data into the Simulation Data Inspector Tool.
Configure the Signal Browser table and specify how you want to graph the data, as described in Understanding the Simulation Data Inspector Interface.
Inspect signals to quickly determine if the run satisfies requirements, as described in Visual Inspection of Signal Data in the Simulation Data Inspector Tool.
If the run is unsatisfactory, delete it. Repeat steps 3 and 4 to collect the desired simulation runs for comparing data.
Optionally assign tolerances to signals and graphically inspect the applied tolerances.
Compare individual signals in the same run, or from different runs, as described in Comparison of Signal Data.
Compare all of the imported signal data from multiple runs, as described in Comparison of All Logged Signal Data From Multiple Simulations.
Determine which signals have discrepancies within the specified tolerances. Plot and analyze the discrepancies of any two signals.
Save the imported signal data and comparison results, as described in Export Results in the Simulation Data Inspector Tool.
The Simulation Data Inspector software provides a command-line interface. For more information, see Record and Inspect Signal Data Programmatically
Record Simulation Data into the Simulation Data Inspector Tool
Import Logged Signal Data into the Simulation Data Inspector Tool
The Simulation Data Inspector tool records the following data configured on the Data Import/Export Pane of the Configuration Parameter dialog box:
States and Output, if Format is Structure with time, or if Format is Array or Structure and Time is logged.
Signal logging
Data stores
The Simulation Data Inspector tool supports the following data imported from MAT-files and the MATLAB base workspace:
Simulink.Timeseries and MATLAB timeseries objects
Simulink.SimulationData.Dataset or Simulink.ModelDataLogs objects
Data in Structure with time format
The Simulation Data Inspector supports output from the following blocks:
Scope and Floating Scope (Structure with time and Array format)
To File (Timeseries format)
To Workspace (Timeseries or Structure With Time format)
Record Signal Data Automatically After Simulation. You can configure your model to automatically open the Simulation Data Inspector tool and record simulation data every time you run or pause a simulation.
Select Simulation > Configuration Parameters to open the Configuration Parameters dialog box.
Select the Data Import/Export pane.
Select the Signal logging parameter.
Select the Record and inspect simulation output parameter.
Select a Signal logging format.

Record Signal Data Interactively With Simulations. To set the Simulation Data Inspector to automatically import data after a simulation run:
Open the Simulation Data Inspector tool.
Click the Record button
.
In the model diagram window, simulate your model. When the simulation is done, the data automatically appears within a new run in the Simulation Data Inspector tool. To modify the run name, see Rename a Run.
To import another simulation run, leave the Record button selected, and simulate your model again. When the simulation is done, the data appears as another new run.
When you are done importing data for your simulations, click the Record button. If the record button is not selected, data from simulations are not imported into the tool.
Before importing data into the Simulation Data Inspector tool, you must have previously logged signal data to the base workspace or to a MAT-file. For information on how to log signal data, see Exporting Signal Data Using Signal Logging.
Import Signal Data from the Base Workspace. Using the Data Import tool, you can import data from the base workspace.
Open the Data Import tool by selecting the Import
Data button
or
selecting File > Import
Data.
Select Base Workspace. Data from logsout, xout, and yout appear in the table.

Select the Import check box to import a signal. Clear the Import check box for signals that you do not want. You can also use the Select All and Clear All buttons for mass selection or clearing of all signals.
Select OK. The selected signals are displayed in the Signal Browser table.
Import Signal Data from a MAT-File. With the Data Import tool, you can select a subset of signals from a MAT-file to import into the Simulation Data Inspector tool. Follow the steps to import a MAT-File.
Open the Data Import tool by selecting the Import
Data button
or
selecting File > Import
Data.
For Import From, select MAT file. The File name parameter is enabled.

The Data Import tool locates a MAT-file in the current directory. Alternatively, click the Open folder button to browse for your MAT-file. The data from the MAT-file populates the data table.
Specify Import To by selecting New Run or Existing Run. If you select Existing Run, select a run from the Run Name list.
Select the Import check box to import signals. Clear the Import check box for signals that you do not want. You can also use the Select All and Clear All buttons for selection or clearing of all the signals.
Select OK.
To load signal data from a MAT-file, which was created from the Simulation Data Inspector tool:
On the Simulation Data Inspector toolbar, click the Open button
or
select File > Open.
Select the name of the MAT-file.
Click OK. Data stored in the MAT-file is displayed in the Simulation Data Inspector tool.
On the Inspect Signals tab you can inspect logged signal data. On the left pane you can open the Signal Browser table to view and configure signal and run properties (see Understanding the Simulation Data Inspector Interface). On the right pane you can create different plot views. With a view of multiple plots, you can group signals to better view your data. For example, you can group the same signal from different simulation runs, group signals with a similar range of values, or normalize a subset of your signal data. The following examples use the sldemo_f14 model. These examples demonstrate how to work with views for inspecting your data:
Configure a model to log signal data. This example uses the sldemo_f14 demo model configured to log signals: q, rad/sec, Stick, and NzPilot, g. For more information, see Exporting Signal Data Using Signal Logging.
Open the Simulation Data Inspector. In the Model Diagram window, select Tools > Inspect Logged Signals. For more information, see Open the Simulation Data Inspector Tool.
Click the Record button
to
record simulation data. From the Model Diagram
window, simulate your model. The Simulation Data Inspector
tool records and displays the simulation data. To import signal data
from previous simulation runs, see Import Logged Signal Data into the Simulation Data Inspector
Tool.
If the Inspect Signals tab is not already selected, select it. By default, the Inspect Signals tab displays the Signal Browser table which contains a row for each signal, organized by simulation runs. You can expand or collapse any of the runs to view the logged signals in a run. For more information, see Understanding the Simulation Data Inspector Interface.
Right-click the Signal Browser table title bar. Select Columns and uncheck Block Name and Block Path.
Right-click the Signal Browser table title bar. Select Group Signals. In the Group Signal dialog box, in the first drop-down box, select Logged Variable. Select None in the second drop-down box. Click OK.

Expand logsout to view the logged signals.
Specify the Line Configuration for each signal.
To specify the synchronization method, right-click the Signal Browser table title bar. Select Columns and check Synchronization Method. The Sync Method column is displayed in the table. For each signal, click the field for the Sync Method column and select a method from the list. In this example, the synchronization method is union.
Repeat step 5 for the Interpolation Method.
Click the Plot column for a signal. On the right pane of the Simulation Data Inspector tool, the signal data is displayed in the graph.
To select multiple signals, hold down Ctrl and select each signal by clicking a row. In the Plot column, select a check box. All of the highlighted signals are now selected for plotting.

To create a report of the results, see Create Simulation Data Inspector Report.
Before creating a view of multiple plots, the Simulation Data Inspector tool must contain signal data. You can obtain signal data by either recording simulation data or importing data into the Simulation Data Inspector tool. For more information, see Record Simulation Data into the Simulation Data Inspector Tool or Import Logged Signal Data into the Simulation Data Inspector Tool.
On the right pane, on the View toolbar, click Show Details.
![]()
In the View Name column, click the field which displays Default. Type in a new name for the view. In this example, the name is sldemo_f14_plot4.
In the Layout column, click the field that displays 1x1. A plot matrix opens. To create a view of 4 plots, select the 2x2 matrix.

To select a plot, click it. The selected plot is outlined in blue.
Once a plot is selected, on the left pane in the Signal Browser table, select a signal in the Plot column to add to the selected plot. In this example, a signal from Run 1 is displayed in each plot in the sldemo_f14_plot1 view.

For the selected plot [2,2], the signal or signals are shaded in the Inspect Signals table to indicate which signals are in the selected plot.
Linked Plots in a View. Plots within a view can be linked together to enable synchronized panning and zooming. When you create a view, by default, plots in a view are linked together. The following toolbar operations synchronize across linked plots:
Pan along the time axis:
![]()
Zoom on the time axis:
![]()
Zoom on the time and data value axis:
![]()
Zoom out:
![]()
To determine if a plot in a view is linked, at the
top of each plot, locate the link icon
. If a plot is unlinked,
the broken link icon
is
displayed and the plot pans and zooms independently.
Move Signals Between Plots in a View. To move a signal from one plot to another, click and hold a signal (markers appear).

Drag the signal to another plot, and the signal is now displayed in the other plot.
For more information on working with plots, see Modify a Plot in the Simulation Data Inspector Tool.
In this example, the Simulation Data Inspector tool contains three runs of data. To quickly swap out the data from one run with data from another run, do the following:
Select a view. In this example, the view is sldemo_f14_plot1.
Click Replace runs..., which opens the Replace runs dialog box.

To replace the signal data in Run 2 with the signal data from another run, in the Runs in current view list, select Run 2: sldemo_f14. Only the signals in the view are replaced
In the Replace with list, select Run 3: sldemo_f14.
To specify how the signal data in Run 2 is replaced with Run 3, expand Advanced options. In this example, the Simulation Data Inspector first attempts to align the signals by Data Source, then by Block Path, and lastly by Signal Name. For more information on aligning signals, see How the Simulation Data Inspector Tool Aligns Signals.

Click OK. The data from Run 2 is replaced with data from Run 3.

The View Details table now includes Run
3 instead of Run 2. Run 3 lists
signals from Run 2. The Match column
displays a
for a signal that aligned
with a signal in Run 3. If a signal did not align,
the Match column displays a
.
To copy a view:
On the right pane, in the View toolbar, click Show Details to open the View Details table.
Select the view to copy. Be sure to select the option button next to the View Name in the table.
Click the New view from current button. A new view is displayed in the View Details table

Select the new view, Copy of sldemo_f14_plot4, and rename it.
To delete a view:
On the right pane, in the View toolbar, click Show Details to open the View Details table.
In the View Details table, select the view to delete by selecting the corresponding option button.
Click the Delete View button.
To export a view to a MAT-file:
On the right pane, in the View toolbar, click Show Details to open the View Details table.
Click the Export button and specify a file.
This saves the view, but not the data, into a MAT-file. To save the data and the view, see Export Results in the Simulation Data Inspector Tool.
To reload a saved view from a MAT-file:
On the right pane, in the View toolbar, click Show Details to open the View Details table.
Click the Import button and specify a file.
To include signal data in the Simulation Data Inspector tool, you can record simulation data (see Record Simulation Data into the Simulation Data Inspector Tool), or import data (see Import Logged Signal Data into the Simulation Data Inspector Tool).
In the Simulation Data Inspector tool, you can use the Compare Signals tab of the Signal Browser table for comparing two signals. To compare two signals:
Open the Simulation Data Inspector tool. See Open the Simulation Data Inspector Tool.
Record simulation data or import data into the Simulation Data Inspector tool. See Record Simulation Data into the Simulation Data Inspector Tool or Import Logged Signal Data into the Simulation Data Inspector Tool.
If it is not already selected, select the Compare Signals tab. By default, Signal Browser table on the Compare Signals tab displays a row for each signal data, organized by simulation runs. For more information, see Understanding the Simulation Data Inspector Interface.
Specify the Line Configuration for the signals that you are comparing.
In the Sig 1 column, click one signal for plotting. In this column, you can select only one signal.
In the Sig 2 column, click one signal for plotting. In this column, you can select only one signal.

The Signals graph displays the signal data and the Difference graph displays the difference and tolerance values.

For information on manipulating the graphs, see Understanding the Simulation Data Inspector Interface.
To create a report of the results, see Create Simulation Data Inspector Report.
In the Simulation Data Inspector tool, you can use the Compare Signals tab to compare the same signal from two different simulation runs. To compare two data runs for a signal:
Open the Simulation Data Inspector tool. See Open the Simulation Data Inspector Tool.
Record simulation data or import data for two simulation runs. For more information, see Record Simulation Data into the Simulation Data Inspector Tool or Import Logged Signal Data into the Simulation Data Inspector Tool.
Select the Compare Signals tab. By default, the Signal Browser table on the Compare Signals tab displays a row for each signal data, organized by simulation runs. For more information on modifying the Signal Browser table, see Understanding the Simulation Data Inspector Interface.
Specify the Line Configuration for the signals that you are comparing.
To change the relative tolerance and absolute tolerance, add the Rel Tol and Abs Tol columns to the Signal Browser table. Double-click the corresponding fields for a signal and type in a value.
In the Sig 1 column, click one signal from the first simulation run for plotting. In this column, you can select only one signal.
In the Sig 2 column, click a signal from another simulation run for plotting. In this column, you can select only one signal.

Once two signals are selected, the Signals graph displays the signal data and the Difference graph displays the difference and tolerance values.

For information on manipulating the graphs, see Understanding the Simulation Data Inspector Interface.
To create a report of the results, see Create Simulation Data Inspector Report.
In the Simulation Data Inspector tool, you can use the Compare Runs tab to compare all signal data from two different simulation runs. To compare two runs:
Open the Simulation Data Inspector tool. See Open the Simulation Data Inspector Tool.
Record simulation data or import data from multiple simulation runs, for more information, see Record Simulation Data into the Simulation Data Inspector Tool or Import Logged Signal Data into the Simulation Data Inspector Tool.
Select the Compare Runs tab.
From the Run 1 and Run 2 drop-down lists, select two different runs.

Select the Options button to specify the signal alignment.

The Simulation Data Inspector aligns signals according to Align By and Then By parameters. For more information on signal alignment, see How the Simulation Data Inspector Tool Aligns Signals.
Click the Compare button. The Comparison Results table lists all signals from Run 1 with a result. In this example, the comparison results of the aligned signals did not match.

The Simulation Data Inspector only compares signals
from Run 1 that are aligned with a signal from Run
2. If a signal from Run 1 did not
align with a signal from Run 2, then the Run
1 signal is listed in the Comparison Results table with
a warning
.
To modify the relative tolerance and absolute tolerance, add the Abs Tol 1 column to the Signal Browser table. Double-click the corresponding fields for a signal and type in a value.
To see a signal that is within the acceptable tolerance across two simulation runs, set the absolute tolerance in column Abs Tol 1 to .35.

To plot a signal, in the plot column select the option button for sldemo_f14/Pilot G-force calculation. The Signals graph displays the signal data for the two runs. The Difference graph displays the difference and tolerance values.

For information on manipulating the graph, see Understanding the Simulation Data Inspector Interface.
To create a report of the results, see Create Simulation Data Inspector Report.
To create a report of the current view and data in the Simulation Data Inspector:
In the Menu Bar, select File > Generate Report. The Report Setup dialog box opens.

In the Include in report section, specify which tab to include in the report. For the Compare Runs tab, you can select Report only mismatched signals only to shorten the report or select Report all signals which includes all logged signals in the designated runs.
Specify the File name and Folder, or use the default.
Optionally, select If report exists, increment file name to prevent overwriting, which appends and increments a number to the file name of the report to preserve earlier versions of the report file.
Optionally, select Display partial block path (modelname/.../blockname), which shortens the block path string generated for the report.
Click Generate. The report opens automatically.
The Simulation Data Inspector tool provides the capability to save data collected by the tool to a MAT-file that you can later reload. The format of the MAT-file is different from the format of a MAT-file created from the base workspace.
To save signal data and views to a MAT-File, do the following:
Click Save or select File > Save.
Type the name of the file.
Click OK. Your data and views are now saved in a MAT-file that you can load back into the Simulation Data Inspector.
When the Simulation Data Inspector tool aligns signals across simulation runs, it attempts to match signals between runs by using metadata stored for each signal. You can specify the metadata used to align signals. The metadata options are: Data Source, Path, SID, and Signal Name. By default, the Simulation Data Inspector tool is configured to first align signals by Data Source, then by Path, and then by Signal Name.
To modify the signal alignment specifications see Inspect Signals: Aligning Signals for Replacing a Run or Compare Runs: Aligning Signals for Comparing Signal Data.
To modify how signals are aligned on the Inspect Signals tab, do the following:
Click the Inspect Signals tab.
On the right pane, click Show details.
Click the Replace runs... button. The Replace Runs dialog opens.
Select Advanced options, which displays the Align By and Then By parameters.
Specify the Align By and Then By parameters from the drop-down lists.
When replacing a run, the Simulation Data Inspector tool attempts to align only the signals selected in the current view. Once those signals are aligned, in the view, the aligned signal data from the first run is replaced with signal data from another run. The View Details table displays the signals from the replaced run as follows:
| Status | Result |
|---|---|
|
|
|
|
| Signal not aligned |
To modify how signals are aligned on the Compare Runs tab, do the following:
Click the Compare Runs tab.
Select the Options button, which displays the Align By and Then By parameters.
Specify the Align By and Then By parameters from the drop-down lists.
Click Compare, to align the signal data and compare the aligned signal data.
After signals are aligned from Run 1 with signals from Run 2, the Simulation Data Inspector tool compares only the aligned signals. The Comparison Results table displays the results of all signals from Run 1 as follows:
| Status | Comparison Result |
|---|---|
|
|
|
|
|
|
|
| Signal from Run 1 did not align with a signal from Run 2 |
To compare time series data, the Simulation Data Inspector:
Converts Simulink time series data to MATLAB time series data.
Aligns the time vectors using the default synchronization method union. To change the synchronization method for a signal, add the Sync Method column to the Signal Browser table and choose a method.
Aligns the data vectors using the default interpolation method, zoh (zero-order hold). To change the interpolation method for a signal, add the Interp Method column to the Signal Browser table and choose a method.
Differences the data.
Applies the specified tolerances for plotting the Difference . For more information, see How Tolerances Are Applied.
The default values for the relative tolerance and absolute tolerance for a signal is 0. If you specify tolerances, then the Simulation Data Inspector tool calculates the tolerances as follows:
tolerance = max(absoluteTolerance, relativeTolerance*abs(baselineData));
To change the relative tolerance and absolute tolerance, add the Rel Tol and Abs Tol columns to the Signal Browser table. Double-click the corresponding fields for a signal and type in a value.
The Simulation Data Inspector tool provides the capability to inspect and compare time series data. There are several methods for launching the Simulation Data Inspector tool, see Open the Simulation Data Inspector Tool to choose the method that best supports your workflow. The Simulation Data Inspector tool appears as follows,

The Simulation Data Inspector Window includes the following elements:
Menu Bar
Three tabs: Inspect Signals, Compare Signals, and Compare Runs
The Signal Browser table appears on the three tabs: Inspect Signals, Compare Signals, and Compare Runs. You can customize the information displayed in the Signal Browser table by performing the following tasks:
The Plot View displays in the right pane of the Simulation Data Inspector tool. To modify a plot, refer to the following:
For more information on how to import, inspect, and compare your signal data, see Inspecting and Comparing Logged Signal Data.
To launch the Simulation Data Inspector tool, choose one of the following methods:
MATLAB command-line: Enter
Simulink.sdi.view
Model Diagram window: Select Tools > Inspect Logged Signals
Configuration Parameters Dialog Box: To configure your model to automatically launch the Simulation Data Inspector tool when a simulation is stopped or paused, see Record Signal Data Automatically After Simulation.
There are several methods for populating the Simulation Data Inspector with data.
If you are using the record button to simulate and record data, your model must be setup to export signal data. For more information, see:
After your model is configured to export signal data, see Record Simulation Data into the Simulation Data Inspector Tool.
If you want to view previously logged signal data, see Import Logged Signal Data into the Simulation Data Inspector Tool.
For a list of Simulink data export formats that are not supported in the Simulation Data Inspector, see Limitations of the Simulation Data Inspector Tool.
To add or remove a column, right-click the Signal Browser table title bar. Select Columns and click an option on the list. The column is displayed in the table.

Column Options for the Inspect Signals and Compare Signals Tabs
| Column Option | Value |
|---|---|
| Run | Name of a simulation run |
| Block Path | Path to the source block for the signal |
| Block Name | Name of the source block |
| Line | Line style |
| Absolute Tolerance | Positive number (user-specified) |
| Relative Tolerance | Positive number (user-specified) |
| Synchronization Method | Method to align time vector: union, intersection, uniform (user-specified) |
| Interpolation Method | Method to align data: zoh, linear (user-specified) |
| Data Source | Name for the data (logsout.Stick.Data) |
| Model | Model name for the signal data |
| Signal | Signal name for the data (Stick) |
| Time Series Root | String signifying the name of the Simulink.Timeseries object (logsout.Stick.Time) |
| Time Source | String signifying the array containing the time data (logsout.Stick.Time) |
| Port | Index of the output port that emits the signal logged |
| Dimensions | Number of dimensions of the signal |
| Channel | Channel of matrix data |
Column Options for Compare Runs Tab
| Column Option | Value |
|---|---|
| Result | Result of the comparison for the signal across the specified runs |
| Block Path |
|
| Data Source | String identifying the data source
|
| SID | Simulink Identifier
|
| Absolute Tolerance | Positive number (user-specified) |
| Relative Tolerance | Positive number (user specified) |
| Synchronization Method | Method to align time vector: union, intersection, uniform (user-specified) |
| Interpolation Method | Method to align data: zoh, linear (user-specified) |
| Channel 1 | Channel of matrix data |
After selecting a column option, the new column is added to the table in the order that it appears in the options list.
You can customize the organization of your logged data in the Signal Browser table. By default, data is first organized by run. You can then organize your data by model hierarchy, logged variable, or no hierarchy.
If your model contains referenced models to view, you can group your data by model hierarchy and then by the logged variables. To change the grouping in the Signal Browser table:
Right-click the Signal Browser table and select Group Signals.
In the Group Signals dialog box, in the first Then By list, select Model Hierarchy.
In the second Then By list, select Logged Variable.

Click OK. The Signal Browser table groups the signal data by model and then by the logged variables.

To remove the hierarchy and display a simple list of logged signals, you can select None in the Group Signals dialog box.

The Signal Browser table displays the logged signals as follows:

To rename a run name:
If the Signal Browser table is not grouped by run, right-click the table and in the menu select Group By > Run.
Double-click the Run row.

Type the new run name and press Enter.
Click in the Line column of a signal and click the down arrow. The Line dialog box opens.

Specify the color and the Line Style for the signal.
Click OK.
In the Signal Browser table, right-click a run or signal for a menu list of options.

| To... | Select... |
|---|---|
| Display the list of Column options. See Column Options for the Inspect Signals and Compare Signals Tabs | Columns |
| Group signal data by the specified options: Run, Block Path, Data Source, Model, and Signal Name (this option does not appear in the Compare Runs tab) | Group By |
| Highlight the source of the selected signal in the model diagram | Highlight signal source in model |
| Open the Variable Editor and display the selected signal data | Export signal to variable editor |
| Save signal data in the run to the base workspace | Export run to base workspace |
| Delete the highlighted signal in the Signal Browser table (this option does not appear in the Compare Runs tab) | Delete |
| Display the signal properties of the selected signal | Properties |
The Signal Properties dialog box displays the following signal information.

In the Signal Browser table, right-click a run name to view a list of options. To open the Run Properties dialog box, from the options list, select Properties.

To modify a plot, you can:
Toolbar: Select icons to zoom into data, move the plot, or add a data point to the plot. For more information on these icons, see the Toolbar section.
Plot options: Click
on the plot to select
alternatives for plotting the data.

| To... | Simulation Data Inspector... |
|---|---|
| Original Axes | Plots the data according to the maximum and minimum values of the data points. (default) |
| Normalized Axes | Normalizes the data for each signal from —1 to 1 along the y-axis. If the data is already within that range, the data is displayed as a constant at 1. |
| Stairstep | Plots the data as a stairstep plot. (default) |
| Line | Interpolates the data points and produces a linear plot. |
| Plot in New Figure | Launches the graph in a MATLAB figure window. |
New figure: Click
on the plot and select Plot
in New Figure. The plot opens in a new figure window.

For more information on plotting and customizing your data plots using the GUI tools, see the MATLAB Graphics documentation.
To view an example, see Create, Save, and Print a Figure, in the Simulink Getting Started Guide.
The toolbar contains the following command buttons.
| To... | Click... |
|---|---|
| Clear the Simulation Data Inspector of all data. | New
|
| Open a MAT-file previously saved from the Simulation Data Inspector. | Open
|
| Save data in Simulation Data Inspector to a MAT-file. | Save
|
| Launches the Data Import tool. | Import Data
|
| Enable recording of data from a simulation. After you click the button, simulate your model and the logged data automatically populates the Simulation Data Inspector. | Record
|
| Zoom in along the time axis. After selecting the icon, on the graph, click and hold the left mouse button and drag the mouse to select an area to enlarge. | Zoom in T
|
| Zoom in along the data value axis. After selecting the icon, on the graph, click and hold the left mouse button and drag the mouse to select an area to enlarge. | Zoom in T
|
| Zoom in on a section of the graph along both axes. After selecting the icon, on the graph, click and hold the left mouse button, and drag the mouse to select an area to enlarge. | Zoom in T and Y
|
| Zoom out from the graph. After selecting the icon, click the graph to incrementally zoom out. | Zoom Out
|
| Fit the plot to the graph. After selecting the icon, click the graph to enlarge the plot to fill the graph. | Fit to View
|
| Move the plot in the graph up, down, left, or right. After selecting the icon, on the graph, click and hold the left mouse button and move the mouse to the area of the graph that you want to view. | Pan
|
| Display the T and Y values of a data point in the plot. After selecting the icon, click a point on the line to view a data point. | Data Cursor
|
The following Simulink data export formats are not supported if time is not logged:
Structure
Array
The following Simulink data types are not supported:
Complex data, int64 and unit64
Enumerated data types
The Simulation Data Inspector tool supports up to 3–dimensional time series data.
Using the Simulation Data Inspector API, you can plot signal data, compare two signals, and compare two simulation runs of data. You can use the Simulink.sdi.createRun function to add simulation output data to the Simulation Data Inspector. Once the Simulation Data Inspector contains signal data, you can perform the following tasks:
| To... | Use... |
|---|---|
| View signal data, open the Simulation Data Inspector tool | |
| Compare the data of two signals | |
| Compare the output of two simulation runs |
Simulation Data Inspector software creates and manages a list of simulation runs. Each run is an instance of a Simulink.sdi.Run object. This object contains all of the simulation data and metadata for that simulation run.
| To... | Use... |
|---|---|
| Get the number of runs currently in the Simulation Data Inspector | |
| Get the run ID from the list of simulation runs in the Simulation Data Inspector | |
| Determine if a run ID corresponds to a run currently in the Simulation Data Inspector | |
| Add more data to a run currently in the Simulation Data Inspector | |
| Make a copy of a run currently in the Simulation Data Inspector | |
| Delete a run from the Simulation Data Inspector | |
| Get simulation data for a run in the Simulation Data Inspector | |
| Manages output signal data and metadata of a simulation run | Simulink.sdi.Run class |
| Get the Simulink.sdi.Signal object corresponding to the given signal ID | Simulink.sdi.Run.getSignal method |
| Get the Simulink.sdi.Signal object corresponding to the index into the array signals in the run | |
| Get the signal ID corresponding to the index into the array signals in the run | |
| Determine if a signal ID corresponds to a signal currently in the run |
Each Simulink.sdi.Run object contains a Simulink.sdi.Signal object for each output signal data. This object contains all of the simulation data for the signal and its metadata.
| To... | Use... |
|---|---|
| Get the simulation data and metadata for a signal from one simulation run. | |
| Manages a signal's time series data and metadata for one simulation run. | Simulink.sdi.Signal class |
| To... | Use... |
|---|---|
| Save signal data currently in the Simulation Data Inspector | |
| Load previously saved Simulation Data Inspector session | |
| Clear all data from the Simulation Data Inspector |
| To... | Use... |
|---|---|
| Manage the results of comparing two runs (Simulink.sdi.compareRuns creates the Simulink.sdi.DiffRunResult object) | |
| Manage the results of comparing two signals ( Simulink.sdi.compareSignals creates the Simulink.sdi.DiffSignalResult object) |
To populate the Simulation Data Inspector with runs of simulation data, you must first simulate your model and then call Simulink.sdi.createRun. When using the API, the Simulation Data Inspector does not automatically record simulation data. To create a run of simulation data, you can use the following code:
% Open the model 'sldemo_f14'
load_system('sldemo_f14');
% Configure model "sldemo_f14" for logging and simulate
simOut = sim('sldemo_f14', 'SaveOutput','on', ...
'SaveFormat', 'StructureWithTime', ...
'ReturnWorkspaceOutputs', 'on');
% Create a Simulation Data Inspector run
[runID,runIndex,signalIDs] = Simulink.sdi.createRun('My Run',...
'namevalue',{'MyData'},{simOut});To compare the simulation data for two signals, you can use the following code:
% Configure model "f14" for logging and simulate
simOut = sim('sldemo_f14', 'SaveOutput','on', ...
'SaveFormat', 'StructureWithTime', ...
'ReturnWorkspaceOutputs','on');
% Create a Simulation Data Inspector run and get signal IDs
[~, ~, signalIDs] = Simulink.sdi.createRun('My Run', ...
'namevalue', {'MyData'}, {simOut});
sig1 = signalIDs(1);
sig2 = signalIDs(2);
% Compare two signals, which returns the results in an instance of
% Simulink.sdi.diffSignalResult
diff = Simulink.sdi.compareSignals(sig1, sig2);
% Find if the signal data match
match = diff.match;
% Get the tolerance used in Simulink.sdi.compareSignals
tolerance = diff.tol;
To compare the signal data between two simulation runs, you can use the following code:
% Configure model "sldemo_f14" for logging and simulate
set_param('sldemo_f14/Pilot','WaveForm','square');
simOut = sim('sldemo_f14', 'SaveOutput','on', ...
'SaveFormat', 'StructureWithTime', ...
'ReturnWorkspaceOutputs', 'on');
% Create a Simulation Data Inspector run, Simulink.sdi.Run, from
% simOut in the base workspace
runID1 = Simulink.sdi.createRun('First Run','namevalue',{'simOut'},...
{simOut});
% Simulate again
set_param('sldemo_f14/Pilot','WaveForm','sawtooth');
simOut = sim('sldemo_f14', 'SaveOutput','on', ...
'SaveFormat', 'StructureWithTime', ...
'ReturnWorkspaceOutputs', 'on');
% Create another Simulation Data Inspector run
runID2 = Simulink.sdi.createRun('Second Run','namevalue',{'simOut'},...
{simOut});
% Compare two runs, the result is stored in a
% Simulink.sdi.DiffRunResult object
difference = Simulink.sdi.compareRuns(runID1, runID2);
% Number of comparisons in result
numComparisons = difference.count;
% Iterate through each result element
for i = 1:numComparisons
% Get signal result at index i
signalResult = difference.getResultByIndex(i);
% Get signal IDs for each comparison result
sig1 = signalResult.signalID1;
sig2 = signalResult.signalID2;
% Display if signals match or not
displayStr = 'Signals with IDs %d and %d %s \n';
if signalResult.match
fprintf(displayStr, sig1, sig2, 'match');
else
fprintf(displayStr, sig1, sig2, 'do not match');
end
endTo record and view the results from parallel simulations, use the following methods to get and set the location of the Simulation Data Inspector repository:
This example shows how to run multiple simulations in a parfor loop and record each run in the Simulation Data Inspector tool.
Open the Simulation Data Inspector.
Simulink.sdi.view;
Load the model.
mdl = 'sldemo_f14';
load_system(mdl);Get the location of the simulation data repository.
src = Simulink.sdi.getSource();
Open MATLAB pool with 4 workers.
matlabpool(4);
Run the simulation in a parfor loop.
parfor i=1:4 % Set the location of the simulation data repository of this % worker to be the same for aggregating the data Simulink.sdi.setSource(src); % Run the simulation simOut = sim(mdl,'SaveOutput','on',... 'SaveFormat','StructureWithTime',... 'ReturnWorkspaceOutputs','on'); % Create a simulation run in the Simulink Data Inspector Simulink.sdi.createRun(['Run' num2str(i)],'namevalue',... {'simout'},{simOut}); end
Close the MATLAB pool and all of the models.
matlabpool close; bdclose all;
Refresh the Simulation Data Inspector
Simulink.sdi.refresh();
![]() | Signal Selector | Analyzing Simulation Results | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |