Main Content

Inspect Simulation Data

You can use the Simulation Data Inspector to view and inspect signals from simulations or imported data. The Simulation Data Inspector provides a comprehensive view of your data by allowing you to arrange data from multiple simulations and sources on multiple subplots. You can zoom and pan within plots and use data cursors for close examination of signal values, and you can replay data to analyze signal relationships.

This example shows you how to view and inspect signal data from the model slexAircraftExample using the Simulation Data Inspector.

Configure Signals for Logging

This example uses signal logging to send data to the Simulation Data Inspector. You can also import signal data from the base workspace or a CSV, MDF, Microsoft® Excel®, or MAT-file. For more information, see View Simulation Data in Simulation Data Inspector.

Open the model slexAircraftExample, mark several signals for logging, and run a simulation.

  1. Open the model.

    openExample('simulink_aerospace/AircraftLongitudinalFlightControlExample')
  2. To log the q, rad/sec, the Stick, and the alpha, rad signals using signal logging, select the signals in the model. Then, click Log Signals.

    The logging badge appears above each signal marked for logging.

  3. Double-click the Pilot block. Set Wave form to sine. Click OK.

  4. On the Simulation tab, click Data Inspector to open the Simulation Data Inspector.

  5. Simulate the model. The simulation run appears in the Simulation Data Inspector.

    By default, the Inspect pane lists all logged signals in rows, organized by simulation run. You can expand or collapse any of the runs to view the signals in a run. For more information on signal grouping, see Configure the Simulation Data Inspector.

View Signals

To select signals you want to plot, use the check boxes next to the signals in the table. Select the check boxes next to the q, rad/sec, Stick, and alpha, rad signals. When the signal you want to plot is easier to find in the model, you can click the logging badge for the signal to plot it in the Simulation Data Inspector.

A single run of signal data in the Simulation Data Inspector.

You can also use Browse Mode to quickly view all the signals in a run on time plots. For more information, see Visualize Many Logged Signals.

View Signals on Multiple Plots

You can use subplot layouts to view groups of signals on different subplots. For example, you can arrange the same signal from different simulation runs on the same subplot or view signals that have a similar range of values.

  1. In the model, double-click the Pilot block. Set Wave form to square. Click OK.

  2. Simulate the model.

  3. By default, the Simulation Data Inspector automatically moves prior runs into the archive and transfers the view to the current run. Drag Run 1 from the archive into the work area.

    Run 1 being moved from the archive to the work area

  4. Click Visualizations and layouts and select the 2×1 plot layout.

  5. Click the lower subplot. In the Inspect pane, select the check boxes for the q, rad/sec, Stick, and alpha, rad signals under Run 1.

    The check boxes in the Inspect pane indicate the signals plotted in the selected subplot, outlined in blue.

    Multiple runs of signal data displayed as two subplots in the Simulation Data Inspector.

You can also move signals graphically rather than using the check boxes. Drag the signal from the Inspect pane or another subplot to the subplot where you want to plot it.

For more information on working with plots, see Create Plots Using the Simulation Data Inspector.

Zoom, Pan, and Resize Plots

You can closely inspect signals in a larger viewing area by maximizing a subplot or expanding the view to full screen.

  • — Select Maximize to expand the active subplot to occupy the entire graphical viewing area.

  • — Select Full Screen to view your entire layout using your whole screen. The Simulation Data Inspector automatically collapses the navigation pane so the view of the layout is as large as possible.

You can zoom and pan within subplots that use a time plot visualization to inspect signal values and the relationships between signals. You can access the zoom and pan controls from the toolbar above the plots or from the subplot menu. Each icon allows you to control aspects of the plot using your mouse .

  • You can select the action for the zoom button from the drop-down list.

    • When you want to zoom in on a selected area in the plot, select Zoom In. While you have Zoom In selected, the Simulation Data Inspector adapts the zoom action it performs based on the area of the plot you select. To zoom only in the y dimension, drag vertically. When you drag horizontally, the Simulation Data Inspector zooms only in the t dimension. You can also click and drag to zoom in on a rectangular region.

      The three methods of zooming. From left to right: the zoom cursor selecting a vertical line, the zoom cursor selecting a horizontal line, and the zoom cursor selecting a rectangular box.

      You can click the graphical viewing area to zoom in a fixed amount on both axes. Scrolling with the mouse wheel zooms in and out on both axes.

    • Select Zoom Out to zoom out a fixed amount from the center of the subplot when you click inside the graphical viewing area. You can also use Zoom Out to undo a previous Zoom In operation.

    • Select Zoom in Time to make all mouse actions zoom on the t-axis. You can click the graphical viewing area to zoom in a fixed amount. You can click and drag the graphical viewing area to select a portion of the plot as the limits for the t-axis. Scrolling with the mouse wheel zooms in and out on the t-axis.

    • Select Zoom in Y to make all mouse actions zoom on the y-axis. You can click in the graphical viewing area to zoom in a fixed amount. You can also click and drag to select a portion of the plot as the limits for the y-axis. Scrolling with the mouse wheel zooms in and out on the y-axis.

  • With the mouse pointer selected, you can select signals by clicking them. Pan by clicking anywhere on the plot and dragging the mouse.

  • You can select the fit action to scale the axes.

    Fit to view menu

    • Select Fit to View to scale both the y and time axes to accommodate your plotted data.

    • Select Fit to View in Time to scale the t-axis to fit your data.

    • Select Fit to View in Y to scale the y-axis to fit your data.

Linked Subplots

Subplots are linked by default. Linked plots have a synchronized response when you perform actions that change the time axis, including:

  • Any pan operation involving the t-axis

  • Any zoom operation involving the t-axis

  • Any fit to view operation involving the t-axis

  • Any adjustment to the t-axis limits

To inspect data independently in a subplot, you can unlink the subplot.

  1. Select the subplot you want to unlink.

  2. Click the Visualization Settings button in the upper right of the viewing area.

  3. In the Limits section, clear the Link plot option.

    The broken link symbol appears on the unlinked subplot.

Inspect Simulation Data Using Cursors

In the Simulation Data Inspector, you can inspect signals using data cursors. You can use one or two cursors to inspect your data. To add two cursors, select Two Cursors from the Show/hide data cursors drop-down list.

With two cursors, three time values are displayed: the times that corresponded to each cursor position and the time spanned by the cursors. You can move the two cursors together by dragging the span label between the two cursors. You can also set the span by typing the desired value into the label field.

Two subplots of signal data in the Simulation Data inspector with the Two Cursors option selected.

Practice inspecting data with cursors using one cursor.

  1. Select One Cursor from the Show/hide data cursors drop-down list .

    Two subplots of signal data in the Simulation Data inspector with the One Cursor option selected.

  2. Drag the data cursor left or right to a point of interest. You can also use the arrow keys to move the data cursor from sample to sample.

    To inspect the data at a specific point in time, click the cursor time field and enter the desired time value, for example, 35.5.

    A zoom in of the first run of signal data where the cursor time field has been given a value of 35.5.

    If the signal does not have a sample at the point of interest, the Simulation Data Inspector interpolates the value for the indicated time. An asterisk in the data cursor label indicates that the displayed value is interpolated. For information regarding interpolation methods, see Interpolation.

    A zoom in of the second run of signal data showing asterisks in the data cursor labels.

  3. When you have finished inspecting the data, click Show/hide data cursors to remove the cursor from the viewing area.

Replay Data

You can replay data in the Simulation Data Inspector to inspect signal value changes and relationships between signals. Replaying data in the Simulation Data Inspector has no effect on any models or simulations. To replay data, first show the replay controls by clicking Show/hide replay controls . Then, press Replay .

The Simulation Data Inspector synchronously sweeps a cursor displaying the signal value across all subplots in the view. By default, data replays at a rate of one second per second, which means that replaying one second of data takes one second of clock time. You can adjust the replay speed using the arrows on either side of the label or by clicking the label to type the desired speed. You can also pause the replay and use the step forward and step backward buttons to inspect signal values sample by sample. For a detailed example, see Replay Data in the Simulation Data Inspector.

A still image of the signal data in run 1 and run 2 being replayed.

Inspect Metadata

The Simulation Data Inspector allows you to view signal and run metadata in the Properties pane. In the column on the right, you can edit properties using the white box. When you view a comparison, the Simulation Data Inspector highlights metadata differences in red.

The Properties pane for the signal, q, rad/sec

You can also view metadata for signals as a table under each run in the Inspect pane. To choose which signal properties to display, click Preferences and click Inspect. Select the columns you want to display from the Inspect - Columns list. Columns appear in the table in the order in which you select them.

The Inspect - Columns portion of Preferences

The table describes the metadata properties.

Property NameValue
LineSignal line style and color
Stored UnitsSignal measurement units
Data TypeSignal data type
ComplexitySignal type — real or complex
Complex FormatFormat for visualizing complex data
Sample TimeType of sampling
ModelName of the model that generated the signal
Block NameName of the signal's source block
Block PathPath to the signal's source block
PortIndex of the signal on the block's output port
DimensionsDimensions of the matrix containing the signal
ChannelIndex of signal within matrix
RunName of the simulation run containing the signal
Absolute ToleranceUser-specified, positive-valued absolute tolerance for the signal
Relative ToleranceUser-specified, positive-valued relative tolerance for the signal
Override Global ToleranceUser-specified property that determines whether signal tolerances take priority over global tolerances
Time ToleranceUser-specified, positive-valued time tolerance for the signal
Interp MethodUser-specified interpolation method used to plot the signal
Sync MethodUser-specified synchronization method used to coordinate signals for comparison
Time Series RootName of the variable associated with signals imported from the MATLAB® workspace
Time SourceName of the array containing the time data for signals imported from the MATLAB workspace
Data SourceName of the array containing the data for signals imported from the MATLAB workspace
DescriptionDescription of signal
Display UnitsUnits used to display signal
DomainSignal type for data created by logging simulation data
Display ScalingScaling used to display signal
Display OffsetOffset used to display signal

In the Compare pane, create a similar table of signal properties by choosing from the Compare - Columns list in Preferences . Many parameters have a baseline signal and a comparison signal that you can display independently. When a parameter does not specify baseline or comparison signal, but both signals have the property, the column shows data for the baseline signal. In addition to the parameters listed for the Inspect pane, the Compare pane has columns specific to comparisons.

Property NameValue
Max DifferenceThe maximum difference between the Baseline and Compare to signals
Align ByPrimary signal alignment criterion specified in the Compare - Alignment tab of the Simulation Data Inspector Preferences menu

By default, the table displays a column for baseline name, absolute tolerance, relative tolerance, maximum difference, and results of the comparison. For more information, see Compare Simulation Data.

Related Topics