Generate a Simulation Data Inspector report
Simulink.sdi.report
creates a report that contains plot
snapshots and metadata for signals plotted in the Inspect pane
of the Simulation Data Inspector.
Simulink.sdi.report(
creates
a report as specified by one or more Name,Value
)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.
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');
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.
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
'ReportType','Compare','ShortenBlockPath',true
'ReportType'
— Type of report to create'Inspect'
(default) | 'Compare'
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'
'ReportTitle'
— Report title displayed in header for comparison report'Compare: <Baseline Run> vs. <Compare
To Run>'
(default) | character vectorReport 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'
'ReportAuthor'
— Report author displayed in header for comparison report'<username>'
(default) | character vectorReport 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'
'ReportOutputFolder'
— Folder where report is saved'<current working
folder>/sdireports'
(default) | path
Folder where report is saved, specified as the comma-separated pair
consisting of 'ReportOutputFolder'
and a character
vector.
Example: 'ReportOutputFolder','C:\Users\user1\Desktop'
'ReportOutputFile'
— Report file name'SDI_report.html'
(default) | character vectorReport file name, specified as the comma-separated pair consisting of
'ReportOutputFile'
and a character vector.
Example: 'ReportOutputFile','MyReport.html'
'PreventOverwritingFile'
— Whether to prevent overwriting report filestrue
(default) | false
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
'ColumnsToReport'
— Signal metadata to include in report for plotted signalsSignal 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 Value | Description |
---|---|
SignalName (default) | Signal name |
Line (default) | Signal line style and color |
SID
| Simulink® identifier For more information about SIDs, see Simulink Identifiers |
Units | Signal measurement units |
SigDataType | Signal data type |
SigSampleTime | Method used to sample the signal |
Model | Name of the model that generated the signal |
BlockName | Name of the source block for the signal |
BlockPath
| Path to the source block for the signal |
Port | Index of the signal on the output port of its block |
Dimensions | Dimensions of the matrix containing the signal |
Channel | Index of signal within matrix |
Run | Name of the simulation run containing the signal |
AbsTol
| Absolute tolerance for the signal |
RelTol
| Relative tolerance for the signal |
OverrideGlobalTol | Property that specifies whether signal tolerances take priority over global tolerances |
TimeTol | Time tolerance for the signal |
InterpMethod | Interpolation method |
SyncMethod | Synchronization method used to coordinate signals for comparison |
TimeSeriesRoot | Name of the variable associated with the signal for signals imported from the MATLAB® workspace |
TimeSource | Name of the array containing the time data for signals imported from the MATLAB workspace |
DataSource | Name of the array containing the signal data for signals imported from the MATLAB workspace |
Example: 'ColumnsToReport',metadata
'ShortenBlockPath'
— Whether to shorten block path in reporttrue
(default) | false
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
'LaunchReport'
— Whether to open report when createdtrue
(default) | 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
'SignalsToReport'
— Signals to include in comparison report'ReportOnlyMismatchedSignals'
(default) | 'ReportAllSignals'
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'
ReportStyle
input ignoredBehavior changed in R2020b
Starting in R2020b, the ReportStyle
name-value pair input is
ignored.
In R2020a, you could use the Simulink.sdi.report
function to
create two separate types of comparison report, and you could use the
ReportStyle
name-value pair to indicate the type of report to
create.
From R2020b, the Simulation Data Inspector only produces one comparison report. You can switch between the interactive and printable view within the report.
Simulink.sdi.compareRuns
| Simulink.sdi.compareSignals
| Simulink.sdi.createRun
| Simulink.sdi.Signal
You have a modified version of this example. Do you want to open this example with your edits?