Documentation

Inspect Simulation Data

You can use the Simulation Data Inspector to view and inspect signals from simulations or from imported data. The Simulation Data Inspector provides a comprehensive view of your data by allowing you to group data from multiple simulations on multiple plots. You can also use data cursors for close examination of signal values.

This example shows you how to view and inspect signal data from the slexAircraftExample model 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 record logged simulation data or import signal data from the base workspace or a MAT-file. For more information, see Populate the Simulation Data Inspector with Your Data. Open the slexAircraftExample model, mark signals for logging, and run a simulation.

  1. To open the model, enter slexAircraftExample in the MATLAB® Command Window.

  2. To log the q, rad/sec, the Stick, and the alpha, rad signals to the Simulation Data Inspector, select the signals in the model. Then, click the Simulation Data Inspector drop-down, and select Log Selected Signals.

    The logging badge appears above each signal marked for logging.

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

  4. In the Simulink® Editor, click the Simulation Data Inspector button to open the Simulation Data Inspector.

  5. Simulate the model. A new 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 Organize Your Simulation Data Inspector Workspace.

View Signals

To select signals to view in the graphical viewing area, use the checkboxes next to the signals in the navigation pane. Select the check boxes next to the q, rad/sec, Stick, and alpha, rad signals.

You can also use signal browsing mode to quickly view all the signals in your run.

Inspect Simulation Data with Cursors

In the Simulation Data Inspector, you can inspect signals using data cursors. You can choose to use one or two data cursors.

With two data cursors, three time values are displayed: the time corresponding 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.

Practice inspecting data with cursors by adding one cursor to the plot.

  1. To add a cursor to the plot, click the single cursor button.

  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.

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

    If the signal does not have a sample value 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 Options in the Simulation Data Inspector.

  3. When you have finished inspecting the data, click the single cursor button to remove the cursor from the graphical viewing area.

Zoom and Pan

Zoom and pan to inspect signal values and the relationships between signals. The zoom and pan controls in the Simulation Data Inspector are on the toolstrip above the graphical viewing area. Each icon allows you to control the aspects of the plot your mouse controls.

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

  • Click the fit-to-view option to scale the axes to accommodate your plotted data.

  • When you select the y-axis zoom option, all the 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.

  • The t-axis zoom option makes all the 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.

  • Click the zoom-out option to zoom out a fixed amount.

  • When you select the zoom-in option, all the mouse actions zoom in on both the y- and t-axes. You can click the graphical viewing area to zoom in a fixed amount on both axes. You can also click and drag to select an area to define the y- and t-axes. Scrolling with the mouse wheel zooms in and out on both axes.

View Signals on Multiple Plots

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

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

  2. Simulate the model.

  3. Click the Layout button and specify a 3×1 arrangement in the Grid section of the menu.

  4. Click the middle subplot in the graphical viewing area. In the Inspect pane, select the check boxes for the q, rad/sec, Stick, and alpha, rad signals under Run 2.

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

Move Signals Between Plots

You can also move plotted signals to other subplots graphically, rather than using the check boxes.

  1. Select the signal you want to move.

  2. Drag the signal to the plot where you want to plot it.

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

Linked Subplots

Subplots are linked by default, meaning that all plots in the graphical viewing area stay synchronized when you pan and zoom. Linked plots have a synchronized response when you:

  • Click a plot and drag to pan

  • Perform any zoom operation

  • Fit to view

To pan and zoom independently in a subplot, you can unlink the subplot.

  1. Select the subplot you want to unlink.

  2. Click the settings button in the upper right of the graph.

  3. On the More tab, click the check box labeled Link Subplot.

    The broken link symbol appears on the unlinked subplot.

Inspect Metadata

The Simulation Data Inspector allows you to view run and signal metadata. You can view signal metadata in the properties pane or in the table of signals under each run. You can view run data only in the properties pane.

The properties pane displays the metadata for the selected run or signal. You can edit properties using the white box in the Values column. When you view a comparison, the Simulation Data Inspector highlights metadata differences in red.

Columns in the navigation pane allow you to display signal properties in the table of signals under each run. To add or remove columns in the table, select the columns you want to display from the list on the Columns tab of the navigation pane's Preferences menu. Columns appear in the table in the order in which you select them.

Property NameValue
LineSignal line style and color
UnitsSignal measurement units
Data TypeSignal data type
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

On the Compare pane, many parameters have a Baseline column and a Compare To column that you can display independently. If the Baseline and Compare to signals both have a property, but you can only display one property column, the column shows the Baseline property. In addition to the parameters listed for the Inspect pane, the Compare pane has columns specific to comparisons.

  • Max Difference – The maximum difference between the Baseline and Compare to signals

  • Align By – Primary signal alignment criterion specified in the Alignment tab of the Simulation Data Inspector Preferences menu

By default, the table displays the baseline name column and a column indicating whether the comparisons passed or failed.

Inspect Event-Based Data

The Simulation Data Inspector visualizes data from event-based systems with stem plots. To plot event-based or message data, mark the signal for logging. When you simulate the model, the data appears in the Simulation Data Inspector as a stem plot for each event. The stem plot shows the number of events recorded for each sample time.

Related Topics

Was this topic helpful?