Skip to Main Content Skip to Search
Product Documentation

Inspecting and Comparing Logged Signal Data

Overview

The Simulation Data Inspector software provides the capability to inspect and compare time series data at several stages of your workflow:

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:

  1. Set up your model to log signal data, as in Exporting Signal Data Using Signal Logging.

  2. Open the Simulation Data Inspector tool, as described in Open the Simulation Data Inspector Tool.

  3. 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.

  4. Configure the Signal Browser table and specify how you want to graph the data, as described in Understanding the Simulation Data Inspector Interface.

  5. Inspect signals to quickly determine if the run satisfies requirements, as described in Visual Inspection of Signal Data in the Simulation Data Inspector Tool.

  6. If the run is unsatisfactory, delete it. Repeat steps 3 and 4 to collect the desired simulation runs for comparing data.

  7. Optionally assign tolerances to signals and graphically inspect the applied tolerances.

  8. Compare individual signals in the same run, or from different runs, as described in Comparison of Signal Data.

  9. Compare all of the imported signal data from multiple runs, as described in Comparison of All Logged Signal Data From Multiple Simulations.

  10. Determine which signals have discrepancies within the specified tolerances. Plot and analyze the discrepancies of any two signals.

  11. 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 or Import Data into the Simulation Data Inspector Tool

Data Requirements

The Simulation Data Inspector tool records the following data configured on the Data Import/Export Pane of the Configuration Parameter dialog box:

The Simulation Data Inspector tool supports the following data imported from MAT-files and the MATLAB base workspace:

The Simulation Data Inspector supports output from the following blocks:

Record Simulation Data into the Simulation Data Inspector Tool

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.

  1. Select Simulation > Configuration Parameters to open the Configuration Parameters dialog box.

  2. Select the Data Import/Export pane.

  3. Select the Signal logging parameter.

  4. Select the Record and inspect simulation output parameter.

  5. 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:

  1. Open the Simulation Data Inspector tool.

  2. Click the Record button .

  3. 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.

  4. 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.

  5. 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.

Import Logged Signal Data into the Simulation Data Inspector 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.

  1. Open the Data Import tool by selecting the Import Data button or selecting File > Import Data.

  2. Select Base Workspace. Data from logsout, xout, and yout appear in the table.

  3. 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.

  4. 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.

  1. Open the Data Import tool by selecting the Import Data button or selecting File > Import Data.

  2. For Import From, select MAT file. The File name parameter is enabled.

  3. 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.

  4. Specify Import To by selecting New Run or Existing Run. If you select Existing Run, select a run from the Run Name list.

  5. 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.

  6. Select OK.

Load Previously Recorded Data from a MAT-file

To load signal data from a MAT-file, which was created from the Simulation Data Inspector tool:

  1. On the Simulation Data Inspector toolbar, click the Open button or select File > Open.

  2. Select the name of the MAT-file.

  3. Click OK. Data stored in the MAT-file is displayed in the Simulation Data Inspector tool.

Visual Inspection of Signal Data in the Simulation Data Inspector Tool

Overview

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:

View Signal Data

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Right-click the Signal Browser table title bar. Select Columns and uncheck Block Name and Block Path.

  6. 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.

  7. Expand logsout to view the logged signals.

  8. Specify the Line Configuration for each signal.

  9. 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.

  10. Repeat step 5 for the Interpolation Method.

  11. 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.

  12. 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.

  13. To create a report of the results, see Create Simulation Data Inspector Report.

Create a View of Multiple Plots

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.

  1. On the right pane, on the View toolbar, click Show Details.

  2. 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.

  3. 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.

  4. To select a plot, click it. The selected plot is outlined in blue.

  5. 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.

Explore Signal Data in a Multiple Plot View

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:

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.

Replace a Run in a View

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:

  1. Select a view. In this example, the view is sldemo_f14_plot1.

  2. Click Replace runs..., which opens the Replace runs dialog box.

  3. 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

  4. In the Replace with list, select Run 3: sldemo_f14.

  5. 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.

  6. 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 .

Copy a View in the Inspect Signals Tab

To copy a view:

  1. On the right pane, in the View toolbar, click Show Details to open the View Details table.

  2. Select the view to copy. Be sure to select the option button next to the View Name in the table.

  3. Click the New view from current button. A new view is displayed in the View Details table

  4. Select the new view, Copy of sldemo_f14_plot4, and rename it.

Delete a View in the Inspect Signals Tab

To delete a view:

  1. On the right pane, in the View toolbar, click Show Details to open the View Details table.

  2. In the View Details table, select the view to delete by selecting the corresponding option button.

  3. Click the Delete View button.

      Note   The View Details table always includes one view.

Export a View in the Inspect Signals Tab

To export a view to a MAT-file:

  1. On the right pane, in the View toolbar, click Show Details to open the View Details table.

  2. Click the Export button and specify a file.

  3. 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.

Import a View in the Inspect Signals Tab

To reload a saved view from a MAT-file:

  1. On the right pane, in the View toolbar, click Show Details to open the View Details table.

  2. Click the Import button and specify a file.

      Note   This only imports the configuration of the view, which is how the signal data is plotted among the multiple plots. The actual signal data is not imported.

  3. 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).

Comparison of Signal Data

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:

  1. Open the Simulation Data Inspector tool. See Open the Simulation Data Inspector Tool.

  2. 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.

  3. 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.

  4. Specify the Line Configuration for the signals that you are comparing.

  5. In the Sig 1 column, click one signal for plotting. In this column, you can select only one signal.

  6. 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.

  7. To create a report of the results, see Create Simulation Data Inspector Report.

Comparison of One Signal From Multiple Simulations

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:

  1. Open the Simulation Data Inspector tool. See Open the Simulation Data Inspector Tool.

  2. 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.

  3. 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.

  4. Specify the Line Configuration for the signals that you are comparing.

  5. 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.

  6. In the Sig 1 column, click one signal from the first simulation run for plotting. In this column, you can select only one signal.

  7. 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.

  8. To create a report of the results, see Create Simulation Data Inspector Report.

Comparison of All Logged Signal Data From Multiple Simulations

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:

  1. Open the Simulation Data Inspector tool. See Open the Simulation Data Inspector Tool.

  2. 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.

  3. Select the Compare Runs tab.

  4. From the Run 1 and Run 2 drop-down lists, select two different runs.

      Note   The number in a column name indicates the run number. For example, Abs Tol 1 refers to the absolute tolerance values for signals of the run specified for Run 1. Abs Tol 2 refers to the absolute tolerance values for signals of the run specified for Run 2.

  5. 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.

  6. 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 .

  7. 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.

      Note   Tolerances specified in the other tab views do not carry over to the Compare Runs tab.

  8. 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.

  9. 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.

  10. To create a report of the results, see Create Simulation Data Inspector Report.

Create Simulation Data Inspector Report

To create a report of the current view and data in the Simulation Data Inspector:

  1. In the Menu Bar, select File > Generate Report. The Report Setup dialog box opens.

  2. 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.

  3. Specify the File name and Folder, or use the default.

  4. 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.

  5. Optionally, select Display partial block path (modelname/.../blockname), which shortens the block path string generated for the report.

  6. Click Generate. The report opens automatically.

Export Results in the Simulation Data Inspector Tool

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.

Save Data to a MAT-File

To save signal data and views to a MAT-File, do the following:

  1. Click Save or select File > Save.

  2. Type the name of the file.

  3. Click OK. Your data and views are now saved in a MAT-file that you can load back into the Simulation Data Inspector.

How the Simulation Data Inspector Tool Aligns Signals

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.

Inspect Signals: Aligning Signals for Replacing a Run

To modify how signals are aligned on the Inspect Signals tab, do the following:

  1. Click the Inspect Signals tab.

  2. On the right pane, click Show details.

  3. Click the Replace runs... button. The Replace Runs dialog opens.

  4. Select Advanced options, which displays the Align By and Then By parameters.

  5. 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:

StatusResult
  • Signal aligned

  • Signal data is replaced in the view

Signal not aligned

Compare Runs: Aligning Signals for Comparing Signal Data

To modify how signals are aligned on the Compare Runs tab, do the following:

  1. Click the Compare Runs tab.

  2. Select the Options button, which displays the Align By and Then By parameters.

  3. Specify the Align By and Then By parameters from the drop-down lists.

  4. 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:

StatusComparison Result
  • Signal aligned

  • Signal data from two runs matched within the tolerance

  • Signal aligned

  • Signal data from two runs did not match within the tolerance

Signal from Run 1 did not align with a signal from Run 2

How the Simulation Data Inspector Tool Compares Time Series Data

To compare time series data, the Simulation Data Inspector:

  1. Converts Simulink time series data to MATLAB time series data.

  2. 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.

  3. 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.

  4. Differences the data.

  5. Applies the specified tolerances for plotting the Difference . For more information, see How Tolerances Are Applied.

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.

Understanding the Simulation Data Inspector Interface

Overview

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:

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.

Open the Simulation Data Inspector Tool

To launch the Simulation Data Inspector tool, choose one of the following methods:

Why Is the Simulation Data Inspector Tool Empty?

There are several methods for populating the Simulation Data Inspector with data.

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.

Add/Delete a Column in the Signal Browser Table

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 OptionValue
RunName of a simulation run
Block PathPath to the source block for the signal
Block NameName of the source block
LineLine style
Absolute TolerancePositive number (user-specified)
Relative TolerancePositive number (user-specified)
Synchronization MethodMethod to align time vector: union, intersection, uniform (user-specified)
Interpolation MethodMethod to align data: zoh, linear (user-specified)
Data SourceName for the data (logsout.Stick.Data)
ModelModel name for the signal data
SignalSignal name for the data (Stick)
Time Series RootString signifying the name of the Simulink.Timeseries object (logsout.Stick.Time)
Time SourceString signifying the array containing the time data (logsout.Stick.Time)
PortIndex of the output port that emits the signal logged
DimensionsNumber of dimensions of the signal
ChannelChannel of matrix data

Column Options for Compare Runs Tab

Column OptionValue
ResultResult of the comparison for the signal across the specified runs
Block Path
  • Run 1: Block Path

  • Run 2: Block Path

Data SourceString identifying the data source
  • Run 1: Data Source

  • Run 2: Data Source

SIDSimulink Identifier
  • Run 1: SID

  • Run 2: SID

Absolute TolerancePositive number (user-specified)
Relative TolerancePositive number (user specified)
Synchronization MethodMethod to align time vector: union, intersection, uniform (user-specified)
Interpolation MethodMethod to align data: zoh, linear (user-specified)
Channel 1Channel 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.

Modify Grouping in Signal Browser Table

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:

  1. Right-click the Signal Browser table and select Group Signals.

  2. In the Group Signals dialog box, in the first Then By list, select Model Hierarchy.

  3. In the second Then By list, select Logged Variable.

  4. 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:

Rename a Run

To rename a run name:

  1. If the Signal Browser table is not grouped by run, right-click the table and in the menu select Group By > Run.

  2. Double-click the Run row.

  3. Type the new run name and press Enter.

Specify the Line Configuration

  1. Click in the Line column of a signal and click the down arrow. The Line dialog box opens.

  2. Specify the color and the Line Style for the signal.

  3. Click OK.

Select a Run or Signal Option in the Signal Browser Table

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 TabsColumns
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 diagramHighlight signal source in model
Open the Variable Editor and display the selected signal dataExport 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 signalProperties

The Signal Properties dialog box displays the following signal information.

Display Run Properties

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.

Modify a Plot in the Simulation Data Inspector Tool

To modify a plot, you can:

To view an example, see Create, Save, and Print a Figure, in the Simulink Getting Started Guide.

Toolbar

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

Limitations of the Simulation Data Inspector Tool

The following Simulink data export formats are not supported if time is not logged:

The following Simulink data types are not supported:

The Simulation Data Inspector tool supports up to 3–dimensional time series data.

Record and Inspect Signal Data Programmatically

Overview

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

Simulink.sdi.view

Compare the data of two signals

Simulink.sdi.compareSignals

Compare the output of two simulation runs

Simulink.sdi.compareRuns

Run Management

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

Simulink.sdi.getRunCount

Get the run ID from the list of simulation runs in the Simulation Data Inspector

Simulink.sdi.getRunIDByIndex

Determine if a run ID corresponds to a run currently in the Simulation Data Inspector

Simulink.sdi.isValidRunID

Add more data to a run currently in the Simulation Data Inspector

Simulink.sdi.addToRun

Make a copy of a run currently in the Simulation Data Inspector

Simulink.sdi.copyRun

Delete a run from the Simulation Data Inspector

Simulink.sdi.deleteRun

Get simulation data for a run in the Simulation Data Inspector

Simulink.sdi.getRun

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

Simulink.sdi.Run.getSignalByIndex method

Get the signal ID corresponding to the index into the array signals in the run

Simulink.sdi.Run.getSignalIDByIndex method

Determine if a signal ID corresponds to a signal currently in the run

Simulink.sdi.Run.isValidSignalID method

Signal Management

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.

Simulink.sdi.getSignal

Manages a signal's time series data and metadata for one simulation run.

Simulink.sdi.Signal class

Import/Export Data

To...Use...
Save signal data currently in the Simulation Data Inspector

Simulink.sdi.save

Load previously saved Simulation Data Inspector session

Simulink.sdi.load

Clear all data from the Simulation Data Inspector

Simulink.sdi.clear

Comparison Results

To...Use...
Manage the results of comparing two runs (Simulink.sdi.compareRuns creates the Simulink.sdi.DiffRunResult object)

Simulink.sdi.DiffRunResult class

Manage the results of comparing two signals ( Simulink.sdi.compareSignals creates the Simulink.sdi.DiffSignalResult object)

Simulink.sdi.DiffSignalResult class

Create a Run in the Simulation Data Inspector

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});

Compare Signal Data

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;

Compare Runs of Simulation Data

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
end

Record Data During Parallel Simulations

To 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();
  


Related Products & Applications

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