Documentation

Simulink.sdi.report

Generate report from Simulation Data Inspector

Syntax

Description

example

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

example

Simulink.sdi.report(Name,Value) uses additional option specified by one or more Name,Value pair arguments.

Examples

collapse all

Create Report from Runs Pane Plots

% 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 Report from Comparisons Pane Plots

% 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');

Related Examples

Input Arguments

collapse all

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.

Example: 'ColumnsToReport','SignalName'

'ReportToCreate' — Simulation Data Inspector pane and plots set'Inspect Signals' (default) | 'Compare Runs'

Simulation Data Inspector pane and plots to include in the report, specified as the comma-separated pair consisting of 'ReportToCreate' and one of these values:

  • 'Inspect Signals' — Information in the Runs pane.

  • 'Compare Runs' — Information in the Comparisons pane.

Example: 'ReportToCreate','Inspect Signals'

'ReportOutputFolder' — File output location<current working folder>/slprj/sdi (default) | string

Location of the generated report, specified as the comma-separated pair consisting of 'ReportOutputFolder' and a string.

'ReportOutputFile' — Report file name'SDI_report.html' (default) | string

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

'PreventOverwritingFile' — Report overwrite preventiontrue (default) | false

Report overwrite prevention, specified as the comma-separated pair consisting of 'PreventOverwritingFile' and one of the Boolean true or false values. 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.

'ColumnsToReport' — Metadata column specifierarray

Signal and run metadata column specifier, specified as the comma-separated pair consisting of 'ColumnsToReport' and an array of column enumerations.

Array 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 pane columns in a report, create an array signal_metadata.

signal_metadata = [Simulink.sdi.SignalMetaData.Run, Simulink.sdi.SignalMetaData.SyncMethod];
Specify the array as the value in the comma-separated pair.
Simulink.sdi.report('ColumnsToReport',signal_metadata);

These table columns are available for the Runs pane.

Column Enumeration ElementDescription
BlockPath (default)Block path
SignalName (default)Signal name
Line (default)Line style
AbsTol (default)Absolute tolerance
RelTol (default)Relative tolerance
SyncMethodMethod to align time vector: union, intersection, uniform
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
PortIndex of the signal output port
DimensionsNumber of signal dimensions
ChannelChannel of matrix data
RunName of a simulation run
ModelModel name

These table columns are available for the Comparisons pane.

Column Enumeration ElementDescription
Result (default)Result of the signal comparison between Baseline and Compare To runs
AbsTol (default)Absolute tolerance
RelTol (default)Relative tolerance
AlignedBy (default)Metadata used to align signal data between Baseline and Compare To runs
LinkToPlot (default)Link to a plot of each comparison result
BlockPath1Block path for signal from Baseline run
BlockPath2Block path for signal from Compare To run
SignalNameSignal name from Baseline run
DataSource1Name for the data from Baseline run
DataSource2Name for the data from Compare To run
SyncMethodSynchronization method specified for the Baseline run
InterpMethodInterpolation method specified for the Baseline run
Channel1Channel specified for the Baseline run
Channel2Channel specified for the Compare To run

'ShortenBlockPath' — Block path name lengthtrue (default) | false

Block path name length, specified as the comma-separated pair consisting of 'ShortenBlockPath' and one of the Boolean true or false values. 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, then the report displays the entire block path name.

'LaunchReport' — Launch report after creationtrue (default) | false

Launch report after creation, specified as the comma-separated pair consisting of 'LaunchReport' and one of the Boolean true or false values. If the value is true after creation, the generated report opens.

'SignalsToReport' — Comparison signals set'ReportOnlyMismatchedSignals' (default) | 'ReportAllSignals'

For the Comparisons pane report only. Comparison signals set, specified as the comma-separated pair consisting of 'SignalsToReport' and one of these values:

  • 'ReportOnlyMismatchedSignals' — Include only the mismatched signals from the comparison between the Baseline and Compare To runs.

  • 'ReportAllSignals' — Include all signals from the comparison between the Baseline and Compare To runs.

Alternatives

In the Simulation Data Inspector, on the Visualize or Compare tab, click Create Report. For more information, see Create Simulation Data Inspector Report.

Introduced in R2011b

Was this topic helpful?