Main Content

Simulink.sdi.report

Generate a Simulation Data Inspector report

Description

Simulink.sdi.report creates a report that contains plot snapshots and metadata for signals plotted in the Inspect pane of the Simulation Data Inspector.

example

Simulink.sdi.report(Name,Value) creates a report as specified by one or more Name,Value pair arguments. Using this syntax, you can create a report of data plotted in the Inspect pane or a report of comparison results. You can specify details for each report.

Examples

collapse all

Create a report that contains information about and plots of the signals plotted in the Inspect pane of the Simulation Data Inspector. By default, the report contains the metadata displayed for signals in the table on the Inspect pane. This example shows how to specify which metadata to include in the report.

Load the Session File

This example populates the Simulation Data Inspector with data and plotted signals by loading a saved session file. A session file contains the signal data as well as information about plotted signals and plot layout. Load the session file.

Simulink.sdi.load('ex_sldemo_absbrake_slp_Ww.mldatx');

session_screenshot.png

Create a Report for Plotted Signals

The report includes plots and metadata for the plotted signals. By default, the report includes the metadata that corresponds to the columns displayed in the signals table on the Inspect pane. You can include more data in the report by displaying more columns in the Inspect pane. You can also specify the information you want in the report programmatically using the 'ColumnsToReport' name-value pair and the enumeration class Simulink.sdi.SignalMetaData.

signalMetadata = [Simulink.sdi.SignalMetaData.Run, ...
    Simulink.sdi.SignalMetaData.Line, ... 
    Simulink.sdi.SignalMetaData.BlockName, ...
    Simulink.sdi.SignalMetaData.SignalName];

Simulink.sdi.report('ReportType','Inspect', 'ReportOutputFile', ...
    'absbrake_slp_report.html', 'ColumnsToReport', signalMetadata);

The report shows tables of the metadata for plotted signals, organized by run, above a snapshot of the plot.

Use the Simulink.sdi.report function to create a report of comparison results. The report is web-based and interactive, and you can switch between the interactive view and a printable view.

Load Comparison Results

This example loads previously computed comparison results that were saved in an MLDATX file using the saveResult function. The data came from two simulations of the slexAircraftExample model that used different time constant values for the input filter.

Simulink.sdi.load('slexAircraftExampleTsComparison.mldatx');

Create Comparison Report

Create a report that contains the comparison results using the Simulink.sdi.report function. You can specify a title and author for the report that display in the report header.

Simulink.sdi.report('ReportType','Compare', 'ReportTitle',...
    'Compare: Ts = 0.1 vs Ts = 1','ReportAuthor', 'Jane Smith');

The report opens in the system browser once it is generated. Select signals to see the results displayed in the plot and the metadata for the signals in the Properties pane. The report HTML file is in the sdireports folder in the working directory.

Input Arguments

collapse all

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'ReportType','Compare','ShortenBlockPath',true

Type of report to create, specified as the comma-separated pair consisting of 'ReportType' and 'Inspect' or 'Compare'.

  • 'Inspect' –– Create a report that contains plot snapshots and metadata for signals plotted in the Inspect pane of the Simulation Data Inspector.

  • 'Compare' –– Create a report that summarizes comparison results. The comparison report is interactive and includes plot snapshots of comparison results as well as metadata for the compared signals.

Example: 'ReportType','Compare'

Report title displayed in header for comparison report, specified as the comma-separated pair consisting of 'ReportTitle' and a character vector.

You can only specify a report title for a comparison report.

Example: 'ReportTitle','Trial 1 vs. Trial 2'

Report author displayed in header for comparison report, specified as the comma-separated pair consisting of 'ReportAuthor' and a character vector.

You can only specify a report author for a comparison report.

Example: 'ReportAuthor','John Smith'

Folder where report is saved, specified as the comma-separated pair consisting of 'ReportOutputFolder' and a character vector.

Example: 'ReportOutputFolder','C:\Users\user1\Desktop'

Report file name, specified as the comma-separated pair consisting of 'ReportOutputFile' and a character vector.

Example: 'ReportOutputFile','MyReport.html'

Whether to prevent overwriting report files, specified as the comma-separated pair consisting of 'PreventOverwritingFile' and true or false.

  • true enables file overwrite protection.

  • false disables file overwrite protection.

File overwrite protection prevents the Simulation Data Inspector from overwriting an existing file by appending the file name with a number that increments each time you generate a report. When you disable file overwrite protection, the Simulation Data Inspector overwrites the existing report file unless you specify a unique file name.

Example: 'PreventOverwritingFile',false

Signal metadata to include in the report of signals plotted in the Inspect pane of the Simulation Data Inspector, specified as the comma-separated pair consisting of 'ColumnsToReport' and an array. By default, the Inspect report includes the block path, name, line style and color, and data source parameters for each plotted signal.

Note

The ColumnsToReport input does not affect comparison reports. The comparison report always includes all signal metadata, and the summary at the top of the comparison report always includes the signal name, absolute tolerance, relative tolerance, maximum difference, and result for each signal comparison.

Specify metadata to include as an array, using the enumeration class Simulink.sdi.SignalMetaData. For example, to include the name of the simulation run and signal name:

signal_metadata = [Simulink.sdi.SignalMetaData.Run,...
                    Simulink.sdi.SignalMetaData.SignalName];

Then, specify ColumnsToReport as signal_metadata in the name-value pair:

Simulink.sdi.report('ColumnsToReport',signal_metadata)

The table summarizes the metadata available for Inspect report.

Column ValueDescription
SignalName (default)Signal name
Line (default)Signal line style and color
SID

Automatically assigned Simulink® identifier

UnitsSignal measurement units
SigDataTypeSignal data type
SigSampleTimeMethod used to sample the signal
ModelName of the model that generated the signal
BlockNameName of the source block for the signal
BlockPath Path to the source block for the signal
PortIndex of the signal on the output port of its block
DimensionsDimensions of the matrix containing the signal
ChannelIndex of signal within matrix
RunName of the simulation run containing the signal
AbsTol Absolute tolerance for the signal
RelTol Relative tolerance for the signal
OverrideGlobalTolProperty that specifies whether signal tolerances take priority over global tolerances
TimeTolTime tolerance for the signal
InterpMethodInterpolation method
SyncMethodSynchronization method used to coordinate signals for comparison
TimeSeriesRootName of the variable associated with the signal for signals imported from the MATLAB® workspace
TimeSourceName of the array containing the time data for signals imported from the MATLAB workspace
DataSourceName of the array containing the signal data for signals imported from the MATLAB workspace

Example: 'ColumnsToReport',metadata

Whether to shorten block path in report, specified as the comma-separated pair consisting of 'ShortenBlockPath' and true or false.

  • true –– Use the shortened block path in the report.

  • false –– Include the full block path in the report.

Example: 'ShortenBlockPath',false

Whether to open the report when it is created, specified as the comma-separated pair consisting of 'LaunchReport' and true or false.

  • true –– Open the report when it is created.

  • false –– Do not open the report automatically.

Example: 'LaunchReport',false

Signals to include in a comparison report, specified as the comma-separated pair consisting of 'SignalsToReport' and 'ReportOnlyMismatchedSignals' or 'ReportAllSignals'.

  • ReportOnlyMismatchedSignals –– Include only signals with out of tolerance comparison results.

  • ReportAllSignals –– Include all signals.

Example: 'SignalsToReport','ReportAllSignals'

Version History

Introduced in R2011b

expand all