Contents

Simulink.sdi.report

Generate report from Simulation Data Inspector tool

Syntax

Simulink.sdi.report()
Simulink.sdi.report(Name,Value)

Description

Simulink.sdi.report() creates a report of the current view and data in the Runs pane in the Simulation Data Inspector.

Simulink.sdi.report(Name,Value) creates a report using the parameter Name, Value pairs, which specifies the information to include in the report.

Input Arguments

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'ReportToCreate'

Specify which Simulation Data Inspector pane to include in the report

ValueDescription
'Inspect Signals' (default)Information in the Runs pane
'Compare Runs'Information in the Comparisons pane

Default: 'Inspect Signals'

'ReportOutputFolder'

MATLAB string specifying the location of the generated report.

Default: <current working folder>/slprj/sdi

'ReportOutputFile'

MATLAB string specifying the report file name.

Default: 'SDI_report.html'

'PreventOverwritingFile'

Boolean value. If the report file exists and the value is true, then the report generator increments the file name. If false, the report generator overwrites the report file, if it exists.

Default: true

'ColumnsToReport'

Matrix specifying values from the enumeration class, Simulink.sdi.SignalMetaData, which lists all signal metadata available in the Simulation Data Inspector. For example, to include the Run and Synchronization Method columns in the Comparisons pane report, create a variable signal_metadata:

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

Table Columns available for the Runs pane:

Enumeration ElementTable Column Description
BlockPath (default)Block path
SignalName (default)Signal Name
Line (default)Line style
AbsTol (default)Positive number (user-specified)
RelTol (default)Positive number (user-specified)
SyncMethodMethod to align time vector: union, intersection, uniform (user-specified)
DataSourceString signifying the source of data (logsout.Stick.Data)
TimeSeriesRootString signifying the name of the Simulink.Timeseries object (logsout.Stick.Time)
TimeSourceString signifying the array containing the time data (logsout.Stick.Time)
InterpMethodMethod to align data: zoh, linear (user-specified)
PortIndex of the output port that emits the signal logged
DimensionsNumber of dimensions of the signal
ChannelChannel of matrix data
RunName of a simulation run
ModelModel name for the signal data

Table columns available for the Comparisons pane:

ValueDescription
Result (default)Result of the comparison for the signal across the specified runs
AbsTol (default)Absolute tolerance
RelTol (default)Relative tolerance
AlignedBy (default)Metadata used to align signal data between simulation runs
LinkToPlot (default)Link to a plot of each comparison result
BlockPath1Block path for signal from first run
BlockPath2Block path for signal from second run
SignalNameSignal name from first run
DataSource1Name for the data from first run
DataSource2Name for the data from second run
SyncMethodSynchronization method specified for the first run
InterpMethodInterpolation method specified for the first run
Channel1Channel specified for the first run
Channel2Channel specified for the second run

'ShortenBlockPath'

Boolean value. If the value is true and the block path name is too long, the Simulation Data Inspector shortens the name in the report. If the value is false, the entire block path name is displayed in the report.

Default: true

'LaunchReport'

Boolean value. If the value is true after creation, the generated report opens.

Default: true

'SignalsToReport'

For the 'Compare Runs' view only.

ValueDescription
'ReportOnlyMismatchedSignals'Includes only the mismatched signals from comparing two runs
'ReportAllSignals'Includes all signals in the two compared runs

Default: 'ReportOnlyMismatchedSignals'

Examples

Create a report from the Runs pane

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample', 'SaveOutput','on', ...
             'SaveFormat', 'StructureWithTime', ...
             'ReturnWorkspaceOutputs', 'on');
  
% Create a Data Inspector run
[~, ~, signalIDs] = Simulink.sdi.createRun('My Run', 'base', {'simOut'});
  
% Select signals for plotting
for i = 1:length( signalIDs )
   signal = Simulink.sdi.getSignal(signalIDs(i));
   signal.checked = true;
end
  
% Create default report, which is the Runs pane view
Simulink.sdi.report();

Create a report from the Comparisons pane view

% Configure model "slexAircraftExample" for logging and simulate
set_param('slexAircraftExample/Pilot','WaveForm','square');
simOut = sim('slexAircraftExample', '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('slexAircraftExample/Pilot','WaveForm','sawtooth');
simOut = sim('slexAircraftExample', 'SaveOutput','on', ...
             'SaveFormat', 'StructureWithTime', ...
             'ReturnWorkspaceOutputs', 'on');
      
% Create another Simulation Data Inspector run
runID2 = Simulink.sdi.createRun('Second Run','namevalue',{'simOut'},{simOut});

% Compare two runs
difference = Simulink.sdi.compareRuns(runID1, runID2);

% Specify columns to include in the report
metaDataOfInterest = [Simulink.sdi.SignalMetaData.Result, ...
                    Simulink.sdi.SignalMetaData.BlockPath1, ...
                    Simulink.sdi.SignalMetaData.RelTol];
% Report on the run comparison
Simulink.sdi.report('ReportToCreate', 'Compare Runs', ...
                    'ColumnsToReport', metaDataOfInterest, ...
                    'SignalsToReport', 'ReportAllSignals' );

Alternatives

In the Simulation Data Inspector tool, to generate a report, select File > Generate Report.

Was this topic helpful?