SL Rptgen
SL Rptgen
User's Guide
R2021b
How to Contact MathWorks
Phone: 508-647-7000
Getting Started
1
Simulink Report Generator Product Description . . . . . . . . . . . . . . . . . . . . 1-2
Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-28
v
Generate System Design Description Reports
2
System Design Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Predefined Standard Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
What Is the System Design Description? . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
What You Can Do with the Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Report Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
vi Contents
Use Simulink Report Explorer Components in a Report API Report . . . 4-20
Create the Report Explorer Setup File . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
Create a Report Generator Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
vii
View Contents of a System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
View Block Parameters and Signal Properties . . . . . . . . . . . . . . . . . . . . . . 5-8
Access Optional Web View Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
Suppress Link Warning Messages for Embedded Web View Report . . . . 5-34
viii Contents
MathWorks Library Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-39
Masked Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-39
Package name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-39
Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-39
If package exists, increment name to prevent overwriting . . . . . . . . . . . . 5-40
Package Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-40
Include Model Coverage view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-40
Include Embedded Coder view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-40
Include Requirements view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-40
Include Coverage view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-41
Components
6
Classes
7
Functions
8
ix
1
Getting Started
Simulink Report Generator provides functions and APIs that enable you to include block diagrams,
Stateflow® charts, MATLAB® Function blocks, truth tables, data dictionaries, and other model
elements in your reports. You can design and generate reports in PDF, Microsoft® Word, Microsoft
PowerPoint®, and HTML. You can generate standard reports such as system design descriptions, as
well as custom reports containing design artifacts such as generated code, requirements traceability,
documentation, and test results. Artifacts for DO-178, ISO 26262, IEC 61508, and related industry
standards can also be included.
Simulink Report Generator enables you to create web views that let you view, navigate, and share
Simulink models from a web browser without a Simulink license. You can embed model web views in
HTML code generation, requirements, coverage, and other types of reports.
Key Features
• Automated reporting from Simulink and Stateflow
• PDF, Microsoft Word, Microsoft PowerPoint, and HTML formats
• Templates for programmatic and forms-based reporting
• Automatic capture of simulation results and model specifications
• Web views for viewing and navigating models in web browsers
• Artifacts for DO-178 and IEC 61508
1-2
Relationship Between Simulink Report Generator and MATLAB Report Generator
This example shows results reported for Simulink blocks by the Report API BlockFinder class.
This example shows results reported for Stateflow transitions by the Report API
StateflowDiagramElementFinder class.
1-3
1 Getting Started
1-4
Relationship Between Simulink Report Generator and MATLAB Report Generator
See Also
mlreportgen.finder.Finder
1-5
1 Getting Started
More About
• “Report Generation for Simulink and Stateflow Elements” on page 1-9
• “What Is a Reporter?”
• “Create a Report Generator”
• “Create a Simulink Report Generator Report” on page 4-2
• “Create and Use a Web View of a Model” on page 5-12
• “Create an Embedded Web View Report Generator” on page 5-24
1-6
System Design Documentation and Results Reporting
Types of Reports
Two common goals for creating reports are:
• “System Design Documentation” on page 1-7 — Capture information about the design decisions,
structure, implementation, and operational details of a system.
• Results reporting on page 1-7 — Present results of running a system.
You use a similar workflow for creating and generating reports for both goals. However, some
components are particularly useful for each use case.
When you create a Simulink Report Generator report to provide system design documentation, the
report captures information about the system design from the model. Each time that you generate the
report, you see up-to-date documentation for the design.
The table includes examples of components that are useful for system design documentation reports.
Results Reporting
Capturing results from simulating a model is useful for:
1-7
1 Getting Started
The table includes examples of components that are useful in results reports.
You can use components such as the Model Simulation component to control how the model
simulates. Other components, such as the Scope Snapshot, show the results of the simulation.
1-8
Report Generation for Simulink and Stateflow Elements
The Simulink Report API also includes reporter classes, which return an image of the container. This
image is the top level of a model.
Every result object returned by a finder has an associated reporter object, which reports on those
results. The reporter object holds the content and formats the content, such as tables of properties
and data plots. You add the reporter objects to your reports. Use the MATLAB Report API reporters to
define common report elements. See “What Is a Reporter?” for information.
All finders have find, hasNext, and next methods. The find method finds and returns in an array
of result objects all elements for each found element of the specified type. The hasNext and next
methods find and return one element at a time and are used to iterate over a list of results. The
hasNext method checks whether the container has at least one of the element of the specified type.
If the container has one or more of the elements, then the hasNext method queues it for the next
method to find and return as a result object.
All reporters have predefined templates. The template for each reporter defines its formatting, layout,
and content holes. You do not need to change the template or specify any formats, layouts, or holes
1-9
1 Getting Started
unless you want a customized report. You can customize your report by copying and editing its
default template or by using a new template. Editing a copy of the default template gives you a
starting point and structure to follow to customize your template. Using a new template lets you
completely define your template starting with a blank file. To change the order of the report content,
reorder the holes in the template. Finders do not use templates. Another way to customize a reporter
class is by subclassing it.
The default reporter templates for each output type are in a template library, which is at
matlab\toolbox\shared\slreportgen\rpt\rpt\+slreportgen\
+report\@<reporter>\resources\templates\<output>
For example, the path to the default template for the DiagramReporter for PDF output is
matlab\toolbox\shared\slreportgen\rpt\rpt\+slreportgen\
+report\@DiagramReporter\resources\templates\pdf\default.pdftx
For a detailed example of editing a template, see the "Customize a Report API Template" section of
“What Is a Reporter?”
1-10
Report Generation for Simulink and Stateflow Elements
Reporter Classes
1-11
1 Getting Started
1 Import the Report API package, which let you use class names without including their package
names. For example, you can use BlockFinder instead of
slreportgen.finder.BlockFinder. In addition to importing the Simulink Report API base
classes, import the MATLAB Report API base class. A typical report includes a title page, table of
contents, chapters, and sections, which you include as reporter classes in the MATLAB Report
API.
import slreportgen.finder.*
import slreportgen.report.*
import mlreportgen.report.*
2 Load the slrgex_vdp model.
model_name = 'slrgex_vdp';
load_system(model_name)
3 Create the container object to hold the report and open the report. In this case, the output report
is saved in zipped slrgex_vdp_model.htmx HTML report. You can use any output name you
want. If you run the report generator more than once using the same output file name, the output
file is overwritten. To use Simulink Report API finders and reporters in your report generator
program, you must use the fully qualified name to create the container object.
rpt = slreportgen.report.Report('slrgex_vdp_model','html');
open(rpt)
4 Add a chapter and specify its title.
finder = BlockFinder(model_name);
results = find(finder);
6 Loop through the results of the find method and create a section for each block, and add the
block property table to the section. Then, add each section to the chapter. After all blocks have
been added, add the chapter to the report.
1-12
Report Generation for Simulink and Stateflow Elements
close(rpt);
close_system(model_name);
rptview(rpt);
import slreportgen.finder.*
import slreportgen.report.*
import mlreportgen.report.*
model_name = 'slrgex_vdp';
load_system(model_name);
rpt = slreportgen.report.Report('slrgex_vdp_model','html');
open(rpt)
close(rpt)
close_system(model_name)
rptview(rpt)
The chapter heading and the section headings and property tables of the first two blocks of the
resulting report are shown.
1-13
1 Getting Started
To find all blocks, use the BlockFinder. The if statement shows how to test for MATLAB Function
blocks. Use the MATLABFunction reporter to report MATLAB Function block details. The else
statement shows how blocks other than MATLAB Function blocks use the BlockFinder find
method results.
blkfinder = BlockFinder(model_name);
blks = find(blkfinder);
if slreportgen.utils.isMATLABFunction(blks(i).Object)
rptr = MATLABFunction(blks(i).Object);
sec = Section(blks(i).Name);
append(sec,rptr)
append(ch,sec)
else
sec = Section(blks(i).Name);
append(sec,blks(i))
append(ch,sec)
blkfinder = BlockFinder(model_name);
blks = find(blkfinder);
1-14
Report Generation for Simulink and Stateflow Elements
model_name = 'slrgex_radar_eml';
load_system(model_name)
rpt = slreportgen.report.Report('radar','pdf');
open(rpt)
blkfinder = BlockFinder(model_name);
blks = find(blkfinder);
ch = Chapter('Blocks in slrgex_radar_eml Model');
for i=1:length(blks)
if slreportgen.utils.isMATLABFunction(blks(i).Object)
rptr = MATLABFunction(blks(i).Object);
sec = Section(blks(i).Name);
append(sec,rptr)
append(ch,sec)
else
sec = Section(blks(i).Name);
append(sec,blks(i))
append(ch,sec)
end
end
append(rpt,ch)
close(rpt)
close_system(model_name)
rptview(rpt)
An example of the information reported for a MATLAB Function block by the MATLABFunction
reporter is:
1-15
1 Getting Started
An example of the information reported by the find method of the BlockFinder is:
1-16
Report Generation for Simulink and Stateflow Elements
This portion of the code uses a StateFinder object and its find method to find and report on states
in the chart. It loops through the array of found states and adds each one to the chapter.
stFinder = StateFinder(subsys);
states = find(stFinder);
for state = states
append(chapter,state)
end
append(rpt,chapter)
1-17
1 Getting Started
To report on the transitions, use a StateflowDiagramElementFinder object and its find method.
To show the property table with a narrower width than the default, customize the output. First, obtain
the reporter for the result. To set the width, use the TableWidth property of the reporter.
chapter = Chapter("Title","Transitions");
trFinder = StateflowDiagramElementFinder...
("Container",subsys,"Types","transition");
transitions = find(trFinder);
for transition = transitions
rptr = transition.getReporter;
rptr.PropertyTable.TableWidth = "3in";
append(chapter,rptr)
end
append(rpt,chapter)
1-18
Report Generation for Simulink and Stateflow Elements
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = "slrgex_fuelsys_fuel_rate_control";
load_system(model_name);
subsys = "slrgex_fuelsys_fuel_rate_control/control_logic";
rpt = slreportgen.report.Report("output","pdf");
open(rpt)
tp = TitlePage("Title",...
"Control Logic Chart of slrgex_fuelsys_fuel_rate_control");
append(rpt,tp)
append(rpt,TableOfContents);
chapter = Chapter("Title","States");
stFinder = StateFinder(subsys);
states = find(stFinder);
for state = states
append(chapter,state)
end
append(rpt,chapter)
1-19
1 Getting Started
chapter = Chapter("Title","Transitions");
trFinder = StateflowDiagramElementFinder...
("Container",subsys,"Types","transition");
transitions = find(trFinder);
for transition = transitions
rptr = transition.getReporter;
rptr.PropertyTable.TableWidth = "3in";
append(chapter,rptr)
end
append(rpt,chapter)
close(rpt)
close_system(model_name)
rptview(rpt)
See Also
slreportgen.report.Report
More About
• “Relationship Between Simulink Report Generator and MATLAB Report Generator” on page 1-3
• “What Is a Reporter?”
• “Templates”
1-20
Generate Reports Without Customizing
You can use Simulink Report Generator without customizing reports by using:
The System Design Description Report provides summary or detailed information about a system
design represented by a model. You can choose report options by using the report dialog box, or you
can create a customized version using the Report Explorer. You can use the System Design
Description report setup file as a starting point for creating a setup file for your own report. For
details, see “Generate a System Design Description Report” on page 2-5.
The System Requirements report includes information about all the requirements associated with the
model and its objects. You must have Simulink Requirements installed to use the System
Requirements report.
Report API
The Report API, which is based on the DOM API, is a set of document objects, such as title page, table
of contents, chapter, and figure objects, that do the work of dozens of lines of code based on DOM
objects. As a result, the Report API greatly reduces the amount of code needed to generate reports.
As with the DOM API, you can add content to your report in the form of built-in MATLAB objects,
such as strings, number and character arrays, and cell arrays. The Report API converts these to DOM
objects before adding them to your report. You can also use text, paragraph and other DOM objects
directly to format the content that you add to your report.
Web View
A web view is a view of a model that you can explore in a web browser. Web views are useful for
presenting models to audiences and for sharing models with colleagues who do not have MathWorks®
1-21
1 Getting Started
products installed. You can use web views to navigate subsystems and see properties of blocks and
signals. For details, see “Export Models to Web View Files” on page 5-4.
1-22
Report Creation Workflow
1 Open the Report Explorer. In the Simulink Toolstrip, on the Apps tab, under Simulation
Graphics and Reporting, click Report Generator.
2 Create a report setup file for your new report design.
3 Add components to the report setup file. Components determine the behavior and contents of
your report. You can use the supplied components and you can create your own custom
components.
4 Choose a Microsoft Word, HTML, or PDF template or a Report Explorer style sheet to associate
styles with the report setup file.
5 Generate the report.
To create reports programmatically using the Report API and DOM API, see “Report Generator
Development” and “Create Report Programs”.
See Also
Related Examples
• “Generate a Report Using a Template”
• “Add Report Content with Components” on page 4-51
More About
• “Report Setup”
• “Layout Style Sheets”
1-23
1 Getting Started
Report Components
In this section...
“About Report Components” on page 1-24
“Report Structure Components” on page 1-24
“System-Based Components” on page 1-24
“User-Supplied Information Components” on page 1-25
“Dynamic Reporting Components” on page 1-26
“Format Control at the Component Level” on page 1-26
To organize a report into sections, use Chapter/Subsection components. For an example, see
“Create a Section for Each Iteration” on page 4-69.
System-Based Components
The Simulink Report Generator includes components that get information from a model to include in
a report. Using system-based components allows your report to describe the current state of a model.
Once the setup file contains these components, you can generate the report whenever you want to
capture the latest version of a model.
1-24
Report Components
Property table components display property name/property value pairs for objects in tables. Summary
table components insert tables that include specified properties for objects into generated reports.
The tables contain one object per row, with each object property appearing in a column.
To use descriptive information from DocBlock blocks, use the Documentation component.
The Simulink Report Generator also includes system-based components that contain model elements
from the following Simulink products:
• Stateflow
• Fixed-Point Designer™
• Simulink Coder™
• Simulink Check™
• Simulink Requirements
To insert a graphic from a file, use an Image component. To insert ASCII text, use an Import File
component.
To include notes about the report source files, use a Comment component.
1-25
1 Getting Started
A looping component runs its child components a specified number of times. There are several
looping components, including logical loops, Handle Graphics® loops, and model and chart loops. For
model and chart loops, you can control aspects such as the order in which the report sorts blocks.
In addition to stylesheets that control the format and layout of the report, for some components you
can set properties to specify formatting details for that specific instance of a component. For
example, for the Simulink Property Table, you can specify whether to display table borders or
specify the alignment of text in table cells.
1-26
Working with the Report Explorer
To open the Report Explorer, enter report in the MATLAB Command Window.
• The Outline pane on the left shows the hierarchy of components in currently opened report setup
files. Report components can reside within other report components, creating parent, child, and
sibling relationships.
• The Library pane in the middle lists the objects available in the context of the Outline pane.
Tip If the Report Explorer window opens with only two panes, one of the panes is hidden. You can
move the vertical boundaries between the panes to reveal any hidden pane, or to make visible panes
wider or narrower.
1-27
1 Getting Started
Acknowledgments
Simulink Report Generator uses Antenna House® XSL Formatter. Antenna House is a trademark of
Antenna House, Inc.
1-28
2
The System Design Description report provides summary or detailed information about a system
design represented by a model. You can choose report options using the report dialog, or you can
create a customized version using the Report Explorer. For details, see “Generate a System Design
Description Report” on page 2-5.
You can use the System Design Description report setup file as a starting point for creating a setup
file for your own report. For more information, see “Print Model Reports”.
The System Requirements Traceability report requires that you have Simulink Requirements
installed. The System Requirements Traceability report includes information about all the
requirements associated with the model and its objects.
Follow these steps to generate the System Requirements Traceability report from the Simulink
Toolstrip:
1 If the Requirements tab is not available, on the Apps tab, in the Model Verification,
Validation, and Test section, click Requirements Manager.
2 On the Requirements tab, in the Share section, click Share > Generate Model Traceability
Report.
By default, the Simulink Report Generator generates the report for the model from which you invoke
the System Design Description report option.
2-2
System Design Description
Report Contents
You can specify what kinds of information to include in the report, in terms of:
• What elements of a model to include in the report (for example, whether to include subsystems
from custom libraries)
• Whether to generate a summary version or a detailed version of the System Design Description
report.
For details, see “Generate a System Design Description Report” on page 2-5.
Summary Version
Section Information
Report Overview Model version
Root System • Block diagram representing the algorithms that compute root
system outputs
• Description (if available from model)
• Interface: name, data type, and other properties of the system
input and output signals
• Subsystems: the path and a block diagram for each subsystem
• State charts
• Requirements (optional)
Subsystems • Path
• Block diagram
System Design Variables • Design variables
• Functions in design variable expressions
Detailed Version
The detailed version of the report includes all the information that is in the summary form of the
report, as well as more information about the system components. The atomic subsystem information
is more detailed than virtual subsystem information.
Section Information
Report Overview Model version
2-3
2 Generate System Design Description Reports
Section Information
Root system • Block diagram representing the algorithms that compute root
system outputs
• Description (if available from model)
• Interface: name, data type, and other properties of the root
system input and output signals
• Block parameters
To enrich the generated System Design Description, add corresponding information in the model.
2-4
Generate a System Design Description Report
When you generate the report, you can specify layout and content options for:
Tip For faster report generation, set File format to one of the from template options. For
example, select Direct PDF (from template) to output to PDF.
1 Open the model or subsystem for which you want to generate a report. The model must compile
without error for the report to generate.
2 On the Modeling tab, in the Design section, click System Design Report.
3 In the Design Description dialog box, specify layout and content options for the report. To display
detailed information about each option, right-click the label and select What's This.
4 Click Generate.
To create a customized version of the report, click Customize Content. This option creates a copy of
the report setup file and opens the copy in the Report Explorer. See “Customize the System Design
Description” on page 2-6.
See Also
More About
• “System Design Description” on page 2-2
2-5
2 Generate System Design Description Reports
You can create customized versions of the System Design Description report by using the Report
Explorer and, optionally the MATLAB tools for building graphical user interfaces.
By default, when you open a customized version of the report, the System Design Description dialog
box does not open.
1 In the System Design Description dialog box, click the Customize Content button to open the
Report Explorer.
The Report Explorer reflects any changes (for example, a different report name) that you made in
the System Design Description dialog box.
2 In the Report Explorer, add or modify components. See “Add Report Content with Components”
on page 4-51 and “Information Components”.
sdd_custom_data = struct('model',bdroot,'rootSystem',gcs);
You can modify the model argument, which is the model for which you generated the report
and the rootSystem argument, which is the system-level in the model at which, and below
which, you want to use to generate the report.
• Do not remove or modify functions that begin with StdRpt, such as %StdRpt.getChecksum
3 Optionally modify a style sheet (see “Layout Style Sheets”).
4 Save the customized report with a name other than SDD_custom.rpt.
2-6
Customize the System Design Description
2-7
2 Generate System Design Description Reports
A Report API-based system design report uses objects of Report API classes to report on system
components. See “Report Generation for Simulink and Stateflow Elements” on page 1-9.
The gensdd function, which is included with this example, generates a report that includes these
sections:
• Title Page
• Table of Contents
• List of Figures
• List of Tables
• System Hierarchy
• Root System chapter that contains the root block diagram, task and block execution order, and
properties of each block in the root diagram
• SubSystems chapter that contains the diagram, block execution order, and block properties of the
model subsystems
• Charts chapter that contains the charts and chart object properties of each of the model charts
• Design Data chapter that contains the model variables
• System Model Configuration chapter that contains details about the active configuration set for
the model
The complete gensdd function is listed at the end of this example. You can modify the gensdd.m
file to create a custom system design report.
Generate a system design report for the slrgex_sf_car model and specify that the document is a
PDF.
gensdd('slrgex_sf_car','PDF');
2-8
Generate a System Design Report with the Report API
A copy of the report is included with this example in the file sdd_slrgex_sf_car_copy.pdf.
The gensdd function uses objects of these Report API classes to find system design elements and
report on the system design:
• slreportgen.report.SystemHierarchy
• slreportgen.report.Diagram
• slreportgen.report.SystemIO
• slreportgen.report.ExecutionOrder
• slreportgen.report.ModelConfiguration
• slreportgen.finder.SystemDiagramFinder
• slreportgen.finder.ChartDiagramFinder
• slreportgen.finder.DiagramResult
• slreportgen.finder.StateflowDiagramElementFinder
• slreportgen.finder.DiagramElementResult
2-9
2 Generate System Design Description Reports
• slreportgen.report.LookupTable
• slreportgen.report.StateflowObjectProperties
• slreportgen.report.TruthTable
• slreportgen.finder.ModelVariableFinder
• slreportgen.finder.ModelVariableResult
• slreportgen.report.ModelVariable
• slreportgen.finder.BlockFinder
• slreportgen.finder.BlockResult
• slreportgen.report.CFunction
• slreportgen.report.DocBlock
• slreportgen.report.MATLABFunction
• slreportgen.report.SimulinkObjectProperties
• slreportgen.report.TestSequence
• slreportgen.report.Bus
You can use the properties of these objects to filter and format the information that is reported. For
example, in the makeSystemHierarchy function in the gensdd.m file, you can change the system
hierarchy list format to an ordered list by setting the ListFormatter property of the
slreportgen.report.SystemHierarchy reporter.
The report also uses objects of these Report API classes to create and format the sections of the
report:
• mlreportgen.report.TitlePage
• mlreportgen.report.TableOfContents
2-10
Generate a System Design Report with the Report API
• mlreportgen.report.ListOfFigures
• mlreportgen.report.ListOfTables
• mlreportgen.report.Chapter
• mlreportgen.report.Section
You can customize the appearance of the report and sections. See “Report Formatting Approaches”.
function gensdd(model,doctype)
%GENSDD Generates a system design description from the system's model
% gensdd() generates a PDF system design description for the
% slrgex_sf_car model.
%
% gensdd(model) generates a PDF system design description for the
% specified model.
%
% gensdd(model, doctype) generates a system design description document
% from the specified model and document type: 'html', 'docx', or 'pdf'.
%
% The generated document is a description of a dynamic system's design
% generated from its Simulink model. The description contains the
% following sections:
%
% * Title Page
% * Table of Contents
% * List of Figures
% * List of Tables
% * System Hierarchy
% * Root System Chapter -- Contains root block diagram, task and block
% execution order, and properties of each block in the root diagram.
% * Subsystems Chapter -- Contains diagram, block execution order, and
% block properties of model's subsystems.
% * Charts Chapter -- Contains charts and chart object properties of each
% of the model's charts.
% * Design Data Chapter -- Contains the model variables.
% * System Model Configuration Chapter -- Contains details about the
% active configuration set for the model.
import mlreportgen.dom.*
import mlreportgen.report.*
import slreportgen.report.*
if nargin < 1
model = 'slrgex_sf_car';
doctype = 'pdf';
end
if nargin < 2
doctype = 'pdf';
end
hModel = load_system(model);
rpt = slreportgen.report.Report(['sdd_' get_param(model, 'Name')], doctype);
open(rpt);
2-11
2 Generate System Design Description Reports
makeTitlePage(rpt, hModel);
add(rpt, TableOfContents);
add(rpt, ListOfFigures);
add(rpt, ListOfTables);
makeSystemHierarchy(rpt, hModel);
makeRootSystemChapter(rpt, hModel);
makeSubsystemsChapter(rpt, hModel);
makeChartsChapter(rpt, hModel);
makeDesignDataChapter(rpt, hModel);
makeModelConfigurationChapter(rpt, hModel);
close(rpt);
rptview(rpt);
close_system(model);
end
tp = TitlePage;
tp.Title = upper(get_param(hModel, 'Name'));
tp.Subtitle = 'System Design Description';
tp.Author = 'John Doe';
diag = Diagram(hModel);
diag.Scaling = 'custom';
diag.Height = '2in';
diag.Width = '3in';
tp.Image = getSnapshotImage(diag, rpt);
add(rpt, tp);
end
add(ch, SystemIO(hModel));
2-12
Generate a System Design Report with the Report API
add(rpt, ch);
end
% Use a finder to find all the subsystem diagrams in the model. The finder
% returns an array of SystemDiagramResult objects, each of which
% contains a Diagram reporter that creates a snapshot of the subsystem
% diagram
finder = SystemDiagramFinder(hModel);
finder.IncludeRoot = false;
systems = find(finder);
2-13
2 Generate System Design Description Reports
end
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
finder = ChartDiagramFinder(hModel);
charts = find(finder);
if ~isempty(charts)
ch = Chapter("Title", "Charts");
for chart = charts
section = Section("Title", chart.Name);
diag = getReporter(chart);
add(section, diag);
add(ch, section);
end
add(rpt, ch);
end
end
import mlreportgen.dom.*
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
finder = ModelVariableFinder(hModel);
results = find(finder);
n = numel(results);
if n > 0
s = Section("Title", "Design Data Summary");
2-14
Generate a System Design Report with the Report API
for i = 1:n
result = results(i);
% Get link target for variable reporter
lt = getVariableID(result);
value = getVariableValue(results(i));
vars{i, 1} = InternalLink(lt, results(i).Name);
vars{i, 2} = class(value);
vars{i, 3} = results(i).Source;
vars{i, 4} = results(i).SourceType;
end
add(s, t);
add(ch, s);
add(rpt, ch);
end
end
import mlreportgen.report.*
import slreportgen.report.*
modelConfig = ModelConfiguration(hModel);
2-15
2 Generate System Design Description Reports
import mlreportgen.report.*
import slreportgen.finder.*
% If this block creates a bus or selects signals from a bus, report the
% bus signal details
busRptr = slreportgen.report.Bus(elem);
add(section, busRptr);
add(blocksSection, section);
end
add(parent, blocksSection);
end
eo = ExecutionOrder(system);
if ~slreportgen.utils.isModel(system)
% Only show task details for top-level models
eo.ShowTaskDetails = false;
end
add(section, eo)
add(parent, section);
end
See Also
slreportgen.report.SystemHierarchy | slreportgen.report.Diagram |
slreportgen.report.SystemIO | slreportgen.finder.SystemDiagramFinder |
slreportgen.finder.DiagramResult | slreportgen.finder.DiagramElementResult |
slreportgen.finder.StateflowDiagramElementFinder |
slreportgen.finder.ModelVariableFinder | slreportgen.finder.ModelVariableResult
| slreportgen.report.ModelVariable | slreportgen.finder.BlockFinder |
slreportgen.finder.BlockResult | slreportgen.finder.ChartDiagramFinder |
slreportgen.report.SimulinkObjectProperties
More About
• “Report Generation for Simulink and Stateflow Elements” on page 1-9
2-16
3
See Also
Title
Provide the title text. For PDF, Word, and RTF format reports, the title is on the title page. For HTML
format reports, the title is at the top of the report.
3-2
System Design Description Dialog Box
Settings
See Also
Subtitle
Provide the subtitle text. For PDF, Word, and RTF format reports, the subtitle is under the title on the
title page. For HTML format reports, the subtitle is under the title at the top of the report.
Settings
• If you do not want a subtitle, delete the default setting and leave the field blank.
• Subtitle can include letters, numbers, and special characters.
• Length is unlimited.
Tip
If you generate both summary and detailed versions of the report, consider reflecting the type of
report in the subtitle.
See Also
Authors
List the names of the creators of the system for which you are generating the design description. List
of authors is under the subtitle.
Settings
Default: Value of the ModifiedBy parameter for the model. The ModifiedBy parameter indicates
the last person who updated the model.
Tip
To find the creator of the system, in the Simulink Toolstrip, on the Modeling tab, in the Setup
section, click Model Settings and then select Model Properties. Click the History tab.
See Also
3-3
3 System Design Description
Image
Include an image on the title page (for PDF, Word, and RTF format reports) or near the top of the
report (for the HTML format).
Settings
No Default
• Specify the full path to the image file that you want to include in the report or click the Select
Image button to browse to the image file.
• Supported image file formats include:
• GIF
• JPEG
• BMP
• PNG
• TIF
Tip
An example of an image you might want to use is a logo or other graphic for a company, division, or
project involved in the system design.
See Also
Legal Notice
Provide legal notification text. For PDF, Word, and RTF format reports, the legal notice appears at the
bottom of the title page (second page ). For HTML format reports, the legal notice appears near the
top of the report.
Settings
• Length is unlimited.
• The Legal Notice field does not support text formatting (such as bold or italics).
See Also
Design details
To generate a detailed system design description report, use the default (enabled). To generate a
summary description, disable this option.
3-4
System Design Description Dialog Box
Settings
• The summary report provides system design information about the root system and block
diagrams for the subsystems in the model.
• Block diagram
• Interface: name, data type, and other properties of the system input and output signals
• Look-up tables
• State charts
• Requirements (optional)
• The detailed version of the report includes all the information that is in the summary form of the
report. The detailed version includes the following information, in addition to the summary
information. Atomic subsystem information is more detailed than virtual subsystem information.
• Block parameters
• Block execution order for root system and atomic subsystems
• (For atomic subsystems) Checksum that indicates whether the version of an atomic subsystem
used to generate the report differs from other versions of the subsystem
See Also
Model references
To include model references, use the default (enabled). To exclude model references, disable this
option.
Settings
Default: Enabled
See Also
Settings
Default: Enabled
3-5
3 System Design Description
See Also
Requirements traceability
Include links from blocks to the requirements that the blocks meet.
Settings
Default: Enabled
• To capture requirements links in the report, the model must include requirements links. Use
Simulink Requirements to establish requirements links.
• If you use the default (enabled) and there are no requirements links in the model, the generated
report omits the Requirements section.
See Also
Settings
Default: Enabled
Tip
The report explanation (“About this Report”) describes the information in each report section.
See Also
File format
Specify the output format for the report. Generating a report formatted by a template is generally
faster than generating a report formatted by a Report Explorer stylesheet.
Settings
3-6
System Design Description Dialog Box
See Also
Stylesheet or Template
Specify the stylesheet or template to use for the report.
Settings
When you use one of the other output options, you can choose from several standard style sheets or
any customized versions provided at your site.
For the Acrobat(PDF) file format, these are the stylesheet options:
3-7
3 System Design Description
Simple Print
Suppresses title page, table of contents, list of titles
Compact Simple Print
Minimizes page count, suppresses title, table of contents, list of titles
Large Type Print
Uses 12-point font (slightly larger than Standard Print)
Very Large Type Print
Uses 24-point font and landscape paper orientation
Compact Print
Minimizes white space to reduce page count
Unnumbered Chapters & Sections
Chapters and sections are not numbered
Numbered Chapters & Sections
Chapters and sections are both numbered
Paginated Sections
Sections are printed with page breaks
Custom Header
Lets you specify custom headers and footers
Custom Titlepage
Lets you specify custom title page content and presentation
Verbose Print
Lets you specify advanced print options
For the Web (HTML) file format, these are the stylesheet options:
3-8
System Design Description Dialog Box
Single-page Simple
HTML on a single page; suppresses title page and table of contents
Multi-page Simple
HTML on multiple pages; suppresses title page and table of contents
Multi-page Unnumbered Chapters & Sections
HTML on multiple pages; chapters and sections are not numbered
Multi-page Numbered Chapters & Sections
HTML on multiple pages; chapters and sections are not numbered
For the Rich Text Format and Word file formats, these are the stylesheet options:
Default for Rich Text Format and Word file formats: Standard Print
Standard Print
Displays title page, table of contents, list of titles
Simple Print
Suppresses title page, table of contents, list of titles
Compact Simple Print
Minimizes page count, suppresses title, table of contents, list of titles
Large Type Print
Uses 12-point font (slightly larger than Standard Print)
Very Large Type Print
Uses 24-point font and landscape paper orientation
Compact Print
Minimizes white space to reduce page count
Unnumbered Chapters & Sections
Chapters and sections are not numbered
Numbered Chapters & Sections
Chapters and sections are both numbered
See Also
File name
Provide a name for the generated report file.
Settings
Do not include the file format extension. (For example, enter MyReport, but not MyReport.pdf.
3-9
3 System Design Description
Tip
If you generate both summary and detailed versions of the report, consider reflecting the type of
report in the file name.
See Also
Folder
Provide a path to the folder in which to store the generated report file.
Settings
No Default
See Also
Settings
Default: Enabled (increments the file name to prevent overwriting of an existing report file)
Tips
If you generate both summary and detailed versions of the report, consider reflecting the type of
report in the file name.
See Also
Package type
Packaging to use for reports generated using an HTML template
Settings
Default: Zipped
Zipped
Package report files in a single compressed file that has the report name, with a .zip extension.
3-10
System Design Description Dialog Box
Unzipped
Generate the report files in a subfolder of the current folder. The subfolder has the report name.
Both zipped and unzipped
Package the report files as both zipped and unzipped.
Dependency
To use the Packaging type options, set File format to HTML (from template), choose a
packaging options for the output files.
See Also
3-11
4
• Title Page
• Table of Contents
• Root System Chapter — Contains the root block diagram and properties of each block in the root
diagram
• Subsystems Chapter -- Contains the diagram and block properties of each subsystem of the model
• Stateflow Charts Chapter -- Contains charts and chart object properties of each chart in the model
1 Import the API functions.
To eliminate the need to use fully qualified names of Report, Finder, and DOM API functions, use
these statements. For example, instead of using slreportgen.finder.BlockFinder, you can
use BlockFinder.
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.report.*
2 Load the slrgex_sf_car model.
model = load_system('slrgex_sf_car');
3 Create a report object.
4-2
Create a Simulink Report Generator Report
Use a table of contents (TOC) reporter constructor to create a TOC reporter. This reporter
generates a TOC for the report. Add the TOC reporter to the report.
toc = TableOfContents;
append(rpt,toc);
4-3
4 Creating Simulink Reports
Add a model diagram reporter to the chapter. This reporter returns an image of the block
diagram of the model that you add to the chapter.
ch = Chapter("Title","RootSystem");
append(ch,Diagram(model));
4-4
Create a Simulink Report Generator Report
Loop through the block result objects. For each result, construct a section reporter
(mlreportgen.report.Section). This reporter generates a numbered report section based on
its Title and Content properties. Set the section Title property to the name of the block on
which it reports.
Add the current block result to the section reporter. Adding the result sets the section reporter
Content property to a simulink.report.SimulinkObjectProperties reporter. This
SimulinkObjectProperties reporter generates a table of the properties of the current block,
which is then added to the section. Add each subsection to the parent chapter. Then add the
chapter to the report.
blkFinder = BlockFinder(model);
blocks = find(blkFinder);
for block = blocks
section = Section("Title", ...
strrep(block.Name, newline,' '));
append(section,block);
append(ch,section);
end
append(rpt,ch);
4-5
4 Creating Simulink Reports
Create a chapter for the subsystems of the model and the blocks in each subsystem.
ch = Chapter("Title","Subsystems");
9 Find subsystem diagrams in the model.
Find all subsystem diagrams in the model. The finder returns an array of DiagramResult
objects, each of which contains a Diagram reporter that creates a snapshot of the subsystem
diagram.
sysdiagFinder = SystemDiagramFinder(model);
sysdiagFinder.IncludeRoot = false;
4-6
Create a Simulink Report Generator Report
Using loops, create a chapter section for each subsystem. Find the blocks and block elements in
each subsystem. Add a table of block elements to each chapter section and add each section to
the chapter. Then, add the chapter to the report.
while hasNext(sysdiagFinder)
system = next(sysdiagFinder);
section1 = Section("Title",system.Name);
append(section1,system);
blkFinder1 = BlockFinder(system);
elems = find(blkFinder1);
for elem = elems
section2 = Section("Title",...
strrep(elem.Name,newline,' '));
append(section2,elem);
append(section1,section2);
end
append(ch,section1);
end
append(rpt,ch);
4-7
4 Creating Simulink Reports
Note Simulink finders can operate in either array or iterator mode. In array mode, use the finder
find function to return the search results as an array of results. In iterator mode, use the finder
hasNext and next functions to return the search results one-by-one. Use iterator mode when
searching for diagrams in models that have many model references. Iterator mode closes a model
after compiling and searching it, whereas find mode keeps all the models that it searches open.
Having many open models can potentially consume all system memory and slow report
generation. Although the model used in this example does not contain model references, the
example uses iterator mode to illustrate its syntax.
11 Add a chapter for Stateflow charts and objects.
Find all Stateflow charts in the model. Create a chapter. Using loops, add subsections for each
chart. Find all the elements in each chart and add them to the subsections. Then, add the section
to the chapter and the chapter to the report.
chdiagFinder = ChartDiagramFinder(model);
while hasNext(chdiagFinder)
chart = next(chdiagFinder);
section = Section("Title",chart.Name);
append(section,chart);
objFinder = StateflowDiagramElementFinder(chart);
4-8
Create a Simulink Report Generator Report
sfObjects = find(objFinder);
for sfObj = sfObjects
title = sfObj.Name;
if isempty(title)
title = sfObj.Type;
end
objSection = Section("Title",title);
append(objSection,sfObj);
append(section,objSection);
end
append(ch,section);
end
append(rpt,ch);
4-9
4 Creating Simulink Reports
12 Close the report, run the report, and close the model.
close(rpt);
rptview(rpt);
close_system(model);
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.report.*
4-10
Create a Simulink Report Generator Report
model = load_system('slrgex_sf_car');
rpt = slreportgen.report.Report(['sdd_'...
get_param('slrgex_sf_car','Name')],'pdf');
tp = TitlePage;
tp.Title = upper(get_param(model,'Name'));
tp.Subtitle = 'System Design Description';
tp.Author = 'MathWorks';
tp.Image = Diagram(model);
append(rpt,tp);
toc = TableOfContents;
append(rpt,toc);
ch = Chapter("Title","RootSystem");
append(ch,Diagram(model));
blkFinder = BlockFinder(model);
blocks = find(blkFinder);
for block = blocks
section = Section("Title", ...
strrep(block.Name, newline, ' '));
append(section,block);
append(ch,section);
end
append(rpt,ch);
ch = Chapter("Title","Subsystems");
sysdiagFinder = SystemDiagramFinder(model);
sysdiagFinder.IncludeRoot = false;
while hasNext(sysdiagFinder)
system = next(sysdiagFinder);
section1 = Section("Title",system.Name);
append(section1,system);
blkFinder1 = BlockFinder(system);
elems = find(blkFinder1);
for elem = elems
section2 = Section("Title",...
strrep(elem.Name, newline, ' '));
append(section2,elem);
append(section1,section2);
end
append(ch,section1);
end
append(rpt,ch);
objFinder = StateflowDiagramElementFinder(chart);
sfObjects = find(objFinder);
for sfObj = sfObjects
title = sfObj.Name;
if isempty(title)
4-11
4 Creating Simulink Reports
title = sfObj.Type;
end
objSection = Section("Title",title);
append(objSection,sfObj);
append(section,objSection);
end
append(ch,section);
end
append(rpt,ch);
close(rpt);
rptview(rpt);
close_system(model);
See Also
rptview
4-12
Report on MATLAB Function
Other ways to report on MATLAB Function blocks or Stateflow MATLAB functions are by using the
SimulinkObjectProperties or StateflowObjectProperties reporter, respectively. These
reporters, however, do not provide function code formatting or report function symbols, supporting
functions, or arguments. Use these reporters if you want only property information.
The Report API provides finders for finding blocks and Stateflow elements, including MATLAB
Functions, throughout a model or chart. These finders are the BlockFinder,
DiagramElementFinder, and StateflowDiagramElementFinder.
These examples show how to use a finder in your report generator program. For cases where you
know the handle or path to a MATLAB Function, you do not need to use a finder (see
slreportgen.report.MATLABFunction for examples).
Use the BlockFinder to find all blocks of type SubSystem, which includes MATLAB Function blocks.
If you search for all block types, the BlockFinder can take more time to return results than if you limit
the search to SubSystem block types.
blkfinder = slreportgen.finder.BlockFinder(model_name);
blkfinder.BlockTypes = "SubSystem";
blks = find(blkfinder);
Then, loop through the returned SubSystem blocks to test whether the block is a MATLAB Function
block. Create a MATLABFunction reporter for each MATLAB Function block, set desired properties,
and add each result to a report.
for i=1:length(blks)
block = blks(i).Object;
if slreportgen.utils.isMATLABFunction(block)
rptr = MATLABFunction(block);
rptr.IncludeArgumentProperties = true;
add(rpt,rptr);
end
end
This code is an example of a report generator program that finds and reports MATLAB Function
blocks.
import slreportgen.report.*
import slreportgen.finder.*
model_name = 'sldemo_eml_galaxy';
load_system(model_name);
rpt = slreportgen.report.Report;
4-13
4 Creating Simulink Reports
blkfinder = BlockFinder(model_name);
blkfinder.BlockTypes = "SubSystem";
blks = find(blkfinder);
for i=1:length(blks)
block = blks(i).Object;
if slreportgen.utils.isMATLABFunction(block)
rptr = MATLABFunction(block);
rptr.IncludeArgumentProperties = true;
add(rpt,rptr);
end
end
close(rpt);
close_system(model_name);
rptview(rpt);
This image shows a section of the report output for one of the MATLAB Function blocks. It shows the
block properties table, the summary table for one of the arguments, and a portion of the function
script. In the actual output, all of the argument tables appear before the function script.
4-14
Report on MATLAB Function
4-15
4 Creating Simulink Reports
elemfinder = StateflowDiagramElementFinder(chart_name);
elemfinder.Types = "emfunction";
elems = find(elemfinder);
Then, loop through the returned MATLAB functions. Create a MATLABFunction reporter for each
MATLAB function and add it to a report.
for i = 1:length(elems)
rptr = MATLABFunction(elems(i).Object);
add(rpt,rptr);
end
This code is an example of a report generator program that finds and reports MATLAB functions in
Stateflow charts.
import slreportgen.report.*
import slreportgen.finder.*
model_name = 'sf_server';
openExample(model_name);
chart_name = 'sf_server/transmitter';
rpt = slreportgen.report.Report;
elemfinder = StateflowDiagramElementFinder(chart_name);
elemfinder.Types = "emfunction";
elems = find(elemfinder);
for i = 1:length(elems)
rptr = MATLABFunction(elems(i).Object);
add(rpt,rptr);
end
close(rpt);
close_system(model_name);
rptview(rpt);
This image shows a section of the report output for one of the MATLAB Function blocks. It shows the
object properties table and a portion of the function script.
4-16
Report on MATLAB Function
• Use DOM classes — Specify formats using DOM classes, such as mlreportgen.dom.Paragraph,
and use them in your program. For example, this code sets the appearance of the function script.
rptr = slreportgen.report.MATLABFunction;
paraScript = mlreportgen.dom.Paragraph;
paraScript.FontFamilyName = 'Arial';
paraScript.FontSize = '12pt';
paraScript.Color = 'blue';
rptr.FunctionScript = paraScript;
4-17
4 Creating Simulink Reports
• Edit a copy of the default template — The advantage of saving customizations in a new template is
that you can easily reuse those customizations by using that template for another report generator
program The template and style sheets for the MATLABFunction reporter are located in the
matlab\toolbox\shared\slreportgen\rpt\rpt\+slreportgen\+report
\@MATLABFunction\resources\templates folder.
This example shows the steps for copying and editing a MATLABFunction reporter html template.
1 Create a copy of the default html template. In this example, the template package is saved as
myHTMLTemplate.htmtx in the current working folder.
mfunction = slreportgen.report.MATLABFunction;
mfunction.createTemplate('myHTMLTemplate','html');
2 Unzip the template package. The unzipped template package is a folder of document, style
sheet, and image files. In this example, the template package folder is saved to the current
working folder.
unzipTemplate('myHTMLTemplate.htmtx');
3 From the stylesheets folder, open the root.css file in a text editor. The root.css file
contains the default styles for the MATLABFunction reporter. The beginning of the file and
the first style are:
/******************************************************************
* MATLABFunction Reporter
******************************************************************/
.MATLABFunctionFunctionScriptTitle {
font-family: 'Noto Sans', 'Noto Sans CJK JP', 'Noto Sans CJK SC', 'Noto Sans CJK KR';
font-weight: bold;
margin-top: 10pt;
color: black;
white-space: pre;
}
4 Edit the styles as desired. In this example, the top margin above the function script title is
increased to 20 points and the color of the title to blue.
/******************************************************************
MATLABFunction Reporter
******************************************************************/
.MATLABFunctionFunctionScriptTitle {
4-18
Report on MATLAB Function
font-family: 'Noto Sans', 'Noto Sans CJK JP', 'Noto Sans CJK SC', 'Noto Sans CJK KR';
font-weight: bold;
margin-top: 12pt;
color: blue;
white-space: pre;
}
5 Save the file.
6 Zip the template folder into a template package. For this example, the template package is
myHTMLTemplate.htmtx.
zipTemplate('myHTMLTemplate');
7 In your report generator program, to use the saved template, specify the template source.
mfunction.TemplateSrc = 'myHTMLTemplate';
See “Templates for DOM API Report Programs” for additional information.
See Also
slreportgen.report.MATLABFunction | MATLAB Function |
slreportgen.finder.BlockFinder | slreportgen.finder.DiagramElementFinder |
slreportgen.finder.StateflowDiagramElementFinder | zipTemplate | unzipTemplate
4-19
4 Creating Simulink Reports
This example shows how to use the RptFile reporter to include a count of the types of blocks used
in the f14 Simulink model. This information is obtained from the Report Explorer Block Type Count
component and is presented in tables in the generated Report API report.
4-20
Use Simulink Report Explorer Components in a Report API Report
1 To eliminate the need to use fully-qualified names of the report, finder, and utility functions,
import the API functions. For example, instead of using mlreportgen.report.TitlePage, you
can use TitlePage.
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.report.*
import mlreportgen.utils.*
2 Load the f14 model.
model = "f14";
load_system(model);
3 Create a report object to hold the contents of the report. Use a Simulink report constructor
(slreportgen.report.Report) to create a report object You must fully qualify the name of the
constructor to distinguish it from the MATLAB report constructor
(mlreportgen.report.Report). Specify the name of the report as "My Report" and the
output type as PDF.
rpt = slreportgen.report.Report("MyReport","pdf");
4 Add a title page and table of contents to the report.
titlepg = TitlePage();
titlepg.Title = "f14 Model Block Types ";
titlepg.Author = "MathWorks";
add(rpt,titlepg);
toc = TableOfContents;
add(rpt,toc);
4-21
4 Creating Simulink Reports
sysdiag_finder = SystemDiagramFinder(model);
found_diags = find(sysdiag_finder);
6 Use a for loop to create a separate chapter for each system and include a system snapshot with a
single-line caption.
Create a RptFile reporter based on mysetupfile.rpt. The reporter generates a table of block
type counts for the current system. Add the RptFile reporter to the chapter and add the
chapter to the report.
snapshot = Diagram(sysdiag.Path);
oneline = makeSingleLineText(sysdiag.Name);
snapshot.Snapshot.Caption = strcat...
("System Diagram: ",oneline);
add(chap,snapshot);
rptFile = RptFile("mysetupfile.rpt");
rptFile.Model = model;
rptFile.System = sysdiag.Path;
add(chap,rptFile);
add(rpt,chap);
end
The first time this loop runs during report generation, a snapshot and block count of the top-level
system of the model is added to the report.
4-22
Use Simulink Report Explorer Components in a Report API Report
4-23
4 Creating Simulink Reports
model = "f14";
load_system(model);
rpt = slreportgen.report.Report("MyReport","pdf");
titlepg = TitlePage();
titlepg.Title = "f14 Model Block Types ";
titlepg.Author = "MathWorks";
add(rpt,titlepg);
toc = TableOfContents;
add(rpt,toc);
sysdiag_finder = SystemDiagramFinder(model);
found_diags = find(sysdiag_finder);
for sysdiag = found_diags
chap = Chapter(sysdiag.Path);
snapshot = Diagram(sysdiag.Path);
oneline = makeSingleLineText(sysdiag.Name);
snapshot.Snapshot.Caption = strcat...
("System Diagram: ",oneline);
add(chap,snapshot);
rptFile = RptFile("mysetupfile.rpt");
rptFile.Model = model;
rptFile.System = sysdiag.Path;
add(chap,rptFile);
add(rpt,chap);
end
close(rpt);
rptview(rpt);
4-24
Report Systems Hierarchically
Open a model.
model = "slrgex_sf_car";
open_system(model);
titlepage = mlreportgen.report.TitlePage();
titlepage.Title = "Hierarchical Report";
add(rpt, titlepage);
Add a table of contents with the number of levels set to 6, which is the maximum.
toc = mlreportgen.report.TableOfContents();
toc.TOCObj.NumberOfLevels = 6;
add(rpt, toc);
Create system sections for the model by calling the createSystemSection local function (see below).
This function recursively calls itself to create sections for the subsystems.
section = createSystemSection(model);
add(rpt, section);
close(rpt);
rptview(rpt);
A system section is composed of a system snapshot and its subsystems in subsections. To create a
system section, find all systems one level deep by using an slreportgen.finder.DiagramFinder with a
SearchDepth of 1.
4-25
4 Creating Simulink Reports
% Use the finder in iterator mode. The next function returns search results
% one-by-one and the hasNext function determines when there are no more
% search results. To obtain the current system, call the next function
% once.
sysResult = next(df);
% Add a system snapshot and a caption that shows the full diagram path.
% To include additional information about the system, add it to the
% section object.
diag = slreportgen.report.Diagram(sysResult.Object);
diag.Snapshot.appendCaption(sysResult.Path);
add(section, diag);
4-26
Customize Simulink Diagram Hyperlinks in HTML and PDF Reports
Import the DOM and Report API packages so you do not have to use long, fully-qualified class names.
import mlreportgen.dom.*
import slreportgen.report.*
Include the slrgex_sf_car root system diagram using the Diagram reporter
The Diagram reporter overlays each element of the slrgex_sf_car diagram snapshot with a
hyperlink to navigate to a section of the report that describes that element. The hyperlink and its ID
are created using the element's path in the model. For example, a subsystem block, such as Engine
or transmission, includes a hyperlink used for navigating to the corresponding subsystem diagram
snapshot in the report.
diag1 = Diagram(model);
diag1.Snapshot.Caption = strcat("Diagram snapshot for root system: ",model);
add(rpt,diag1);
add(rpt,PageBreak);
This reporter prefaces the report object that it creates with a hyperlink target whose ID is also based
on the reported element's path in the model.The Diagram reporter (diag1) for root system
slrgex_sf_car also uses the same ID to create the hyperlink on the Engine block in the snapshot.
So, clicking on the Engine block automatically targets to this subsystem diagram snapshot in the
report.
engine = strcat(model,"/","Engine");
diag2 = Diagram(engine);
diag2.Snapshot.Caption = strcat("Diagram snapshot for subsystem: ",engine);
add(rpt,diag2);
add(rpt,PageBreak);
Clicking on transmission block in the slrgex_sf_car root system diagram snapshot navigates to
the transmission subsystem diagram snapshot in the report.
4-27
4 Creating Simulink Reports
To customize the target for the hyperlink, remove the link target for this reporter by setting the
LinkTarget property of the reporter to an empty string. This ensures that clicking on the
transmission block in the slrgex_sf_car root system diagram snapshot does not navigate to the
transmission subsystem diagram. Then create a custom target for the hyperlink as described in
the next section.
transmission = strcat(model,"/","transmission");
diag3 = Diagram(transmission);
diag3.LinkTarget = "";
diag3.Snapshot.Caption = strcat("Diagram snapshot for subsystem: ",transmission);
add(rpt,diag3);
add(rpt,PageBreak);
To set a new target for the hyperlink, first use the slreportgen.utils.getObjectID function to
obtain the same ID that the Diagram reporter uses. Use the SimulinkObjectProperties reporter
to generate a property table for the transmission block. Change the LinkTarget property of the
reporter to the ID obtained with slreportgen.utils.getObjectID. The Diagram reporter
(diag1) for root system slrgex_sf_car also uses the same ID to create the hyperlink on the
transmission block in the snapshot, so clicking on the block now targets this block property table.
id = slreportgen.utils.getObjectID(transmission);
props = SimulinkObjectProperties(transmission);
props.LinkTarget = id;
add(rpt,props);
close(rpt);
rptview(rpt);
4-28
Tile Simulink Diagrams
Determine the image tile size that fits onto the page. The optimal tile size is the page size minus the
page margins, gutters, headers and footers. Also, adjust the tile height to allow 0.5 inches for the
caption. Note that for PDF documents, MATLAB Report Generator defines one inch as equal to 96
pixels.
dpi = 96;
units = mlreportgen.utils.units;
4-29
4 Creating Simulink Reports
Call the sliceImage local function (see below) to slice the large image file into image tiles.
Add the tile images to the report. Also, also add a caption to indicate where the tile image belongs in
relation to the overall image.
for i = 1:numel(tiles)
tile = tiles{i};
formalImage = mlreportgen.report.FormalImage(tile.File);
formalImage.ScaleToFit = false;
formalImage.Caption = sprintf('row: %d, col: %d', tile.Row, tile.Col);
add(rpt, formalImage);
end
close(rpt);
rptview(rpt);
To slice an image file into tiles, read in the image file and copy tile-size parts into multiple image files.
4-30
Tile Simulink Diagrams
4-31
4 Creating Simulink Reports
Import Packages
Import the Report API packages so that you do not have to use long, fully qualified class names.
import mlreportgen.report.*
import slreportgen.finder.*
import slreportgen.report.*
Open Model
model = "sldemo_bus_arrays";
open_system(model);
Create Report
Create and open a report object. To create a Microsoft® Word, HTML, or single-file HTML report,
change "pdf" to "docx", "html", or "html-file", respectively.
4-32
Create a Simulink Bus Object Report
finder = ModelVariableFinder(model);
Loop through the variable finder results to find the bus objects and report on them. Use the
getVariableValue method to identify which variables are bus objects. Use the
slreportgen.report.BusObject reporter to report on the bus objects.
while hasNext(finder)
result = next(finder);
if isa(getVariableValue(result),"Simulink.Bus")
% Create a Bus object reporter
busReporter = BusObject(result);
% Create a Chapter
chapter = Chapter(busReporter.Name);
% Add bus to chapter
add(chapter,busReporter)
% Add chapter to the report
add(rpt,chapter);
end
end
Close Report
close(rpt);
rptview(rpt);
To see a more comprehensive bus object report, view the asbhl20_bus_object_report.pdf that
is available with this example. You must have Aerospace Blockset™ to open the asbhl20 model.
rptview asbhl20_bus_object_report.pdf
See Also
slreportgen.finder.ModelVariableResult | slreportgen.report.ModelVariable |
slreportgen.finder.ModelVariableFinder | slreportgen.report.BusObject |
getVariableValue
More About
• “Report Generation for Simulink and Stateflow Elements” on page 1-9
• “What Is a Reporter?”
4-33
4 Creating Simulink Reports
This image shows the input and output summaries included in the report.
Open Model
Open a model. This example uses a model that has top-level input and output blocks and a subsystem
with inputs and outputs. The top-level input signals are stored in a variable, mappedIO, which is
created when the model is opened.
model = "slreportgen_demo_SystemIO";
open_system(model);
Report Setup
Import the Report Generator API packages so you do not have to use long, fully-qualified class names.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
Create and open a Simulink report object. To create a Microsoft® Word, HTML, or single-file HTML
report, change "pdf" to "docx", "html", or "html-file", respectively.
4-34
Report System Inputs and Outputs
finder = SystemDiagramFinder(model);
while hasNext(finder)
system = next(finder);
ch = Chapter("Title",sprintf("System %s",system.Name));
add(ch,system);
For subsystem inputs and outputs, the SystemIO reporter by default includes details about the input
and output ports of the subsystem. For model inputs and outputs, the reporter includes details about
inport and outport blocks. If the system is a model, set the SystemIO options to omit these block
details because this report includes the same information in the "Blocks" section of the chapter.
if strcmp(system.Type,"Simulink.BlockDiagram")
ioRptr.ShowDetails = false;
end
add(ioSect,ioRptr);
add(ch,ioSect);
Create a section to include details about each block in the system. Source and destination blocks
included in SystemIO summary tables link to the corresponding block details in this section.
blkSect = Section("Blocks");
blkFinder = BlockFinder(system);
results = find(blkFinder);
add(blkSect,results);
add(ch,blkSect);
add(rpt,ch);
end
Close Report
4-35
4 Creating Simulink Reports
close(rpt);
rptview(rpt);
4-36
Reporting on DocBlock Blocks
• RTF
• HTML
• Text
In the generated report, the contents of the DocBlock blocks look like this:
Import the API packages so that you can refer to API classes by their unqualified names, that is,
without the names of the class packages in which they reside.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.dom.*
model = 'slreportgen_demo_docblock';
load_system(model);
Create a container to hold the report content. To avoid a compilation error due to the model
containing only virtual blocks, set the CompileModelBeforeReporting property of the report
object to false.
finder = SystemDiagramFinder(model);
for system = find(finder)
4-37
4 Creating Simulink Reports
Create a chapter for each system. Include the system name in the chapter title. Use the chapter to
report on the DocBlock content of the system.
Find all the DocBlock blocks in the current system. Each result returns the DocBlock reporter for the
found DocBlock. The add method invokes the DocBlock reporter.
docBlockFinder = BlockFinder(system);
docBlockFinder.Properties = {'MaskType', 'DocBlock'}';
results = find(docBlockFinder);
if ~isempty(results)
add(ch, results);
else
add(ch, "This system does not have documentation.");
end
add(rpt,ch)
end
close(rpt);
close_system(model);
rptview(rpt);
See Also
slreportgen.report.DocBlock | slreportgen.finder.BlockFinder |
slreportgen.finder.BlockResult | slreportgen.finder.SystemDiagramFinder |
DocBlock
More About
• “Report Generation for Simulink and Stateflow Elements” on page 1-9
• “What Is a Reporter?”
4-38
Report Model Notes
Open Model
model = "slreportgendemo_autotrans";
open_system(model);
Report Setup
Import the Report Generator API packages so that you do not have to use long, fully qualified class
names.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
Create and open a Simulink report object. To create a Microsoft® Word, HTML, or single-file HTML
report, change "pdf" to "docx", "html", or "html-file", respectively.
titlepage = TitlePage("Title",model);
add(rpt,titlepage);
toc = TableOfContents();
add(rpt,toc);
Report on systems
finder = DiagramFinder(model);
while hasNext(finder)
system = next(finder);
Create a new chapter and add the system result, which adds a system snapshot to the report.
ch = Chapter("Title",system.Name);
add(ch,system);
Add model notes to the current system. If the current system does not have any notes associated with
it, nothing is added.
notes = Notes(system);
add(ch,notes);
add(rpt,ch);
end
4-39
4 Creating Simulink Reports
Close Report
close(rpt);
rptview(rpt);
See Also
slreportgen.finder.DiagramResult
More About
• “Report Generation for Simulink and Stateflow Elements” on page 1-9
• “What Is a Reporter?”
4-40
Report Execution Order of Tasks and Blocks in a Simulink System
Block execution can be separated into different tasks based on sample time if the “Treat each
discrete rate as a separate task” configuration parameter is selected. Export-function models and
systems containing certain blocks, such as asynchronous interrupts or event-triggered subsystems,
also group block execution into different tasks. See “Control and Display Execution Order” for more
information on viewing task information and block execution order in Simulink®.
This image shows a diagram of the sample model slreportgen_demo_ExecutionOrder and the
task summary and block execution order for the model.
4-41
4 Creating Simulink Reports
4-42
Report Execution Order of Tasks and Blocks in a Simulink System
Because the model is a continuous system, the main task, Cont, has a sample time value of 0. In all
models, constant blocks are separated into Constant tasks.
Open Model
Open a model. This example uses a single-tasking model, that is, all blocks except constant blocks
execute during the same task.
model = "slreportgen_ExecutionOrder_example";
open_system(model);
Report Setup
Import the Report Generator API packages so you do not have to use long, fully qualified class names.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
Create and open a Simulink report object. To create a Microsoft® Word, HTML, or single-file HTML
report, change "pdf" to "docx", "html", or "html-file", respectively.
finder = SystemDiagramFinder(model);
while hasNext(finder)
system = next(finder);
ch = Chapter("Title",sprintf("System %s",system.Name));
add(ch,system);
Report the execution order of the system only if it is a block diagram or a nonvirtual subsystem.
Blocks within virtual subsystems are reported in the parent's block execution order.
4-43
4 Creating Simulink Reports
For subsystems, set the ExecutionOrder options so that task details are not reported, because this
information is already reported by the parent block diagram execution order.
if isNonvirtualSubsystem
eoRptr.ShowTaskDetails = false;
end
Add the ExecutionOrder reporter to the Execution Order chapter, and add the chapter to the
report.
add(eoSect,eoRptr);
add(ch,eoSect);
end
Create a section to include details about each block in the system. Blocks included in
ExecutionOrder block execution order lists link to the corresponding block details in this section.
blkSect = Section("Blocks");
blkFinder = BlockFinder(system);
results = find(blkFinder);
add(blkSect,results);
add(ch,blkSect);
add(rpt,ch);
end
close(rpt);
rptview(rpt);
To see how execution order is reported for other types of models, view the sample reports available
with this example.
Multitasking Models
4-44
Report Execution Order of Tasks and Blocks in a Simulink System
The model is also configured to display blocks color-coded by sample time. Blocks that execute at a 1
second sample time are red, and blocks that execute at a 2 second sample time are green. Multirate
blocks, such as the rate-transition block between the Integrator block and the two subsystems, are
yellow. To programmatically configure a model in this way, execute this command:
The execution order for this model reports two tasks. The Trigger column of the task details table
reports the sample time, in seconds, for each task.
The model blocks are separated by task. The rate-transition block executes during both tasks, so it is
included in both lists. However, only its output port executes during task D1, and only its input port
executes during task D2.
4-45
4 Creating Simulink Reports
rptview("slreportgen_demo_Multitasking_Report.pdf")
Nonperiodic Tasks
Some tasks, such as those created by asynchronous interrupts or event listeners, do not execute
based on sample time. For example, the sample model slreportgen_demo_InitResetTerm uses
three subsystems with the execution controlled by event listeners. Each event listener is configured
to execute a subsystem when it receives an initialize, reset, or terminate function-call event.
4-46
Report Execution Order of Tasks and Blocks in a Simulink System
The initialize, reset, and terminate events are reported as separate tasks in the execution order. Their
execution does not directly depend on the sample time of the model, so they are not given an order
number in the task table. The SourceBlock column denotes which block defines the task.
rptview("slreportgen_demo_InitResetTerm_Report.pdf")
Conditional Execution
4-47
4 Creating Simulink Reports
The conditionally executed subsystems are not reported in the block execution order list because they
do not necessarily execute at every time step. Instead, they are included in a Conditional
Execution table that is reported after the block execution order list.
4-48
Report Execution Order of Tasks and Blocks in a Simulink System
rptview("slreportgen_demo_ConditionalExecution_Report.pdf")
See Also
slreportgen.report.ExecutionOrder
More About
• “Report Generation for Simulink and Stateflow Elements” on page 1-9
• “Generate a System Design Report with the Report API” on page 2-8
• “What Is a Reporter?”
• “Treat each discrete rate as a separate task”
• “Control and Display Execution Order”
4-49
4 Creating Simulink Reports
• Opens a Simulink model for the van der Pol equation, called the slrgex_vdp model.
• Sets the Gain parameter for the Mu block to five different values.
• Simulates the model each time the Gain parameter is set.
• Collects the results. Results that fall within a specified range appear in a table in the generated
report.
You do not need to know MATLAB or Simulink software to create and run this example report.
However, knowledge of these products will help you understand the MATLAB code and model
simulation that executes.
This example includes separate sections for different kinds of report creation and generation task.
Each section builds on the previous sections. However, if you want to see the report setup
components for a later section without doing the previous sections, in MATLAB you can view the
completed report setup file by opening the simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
1 Start Simulink.
2 Open the Report Explorer from the Simulink Toolstrip. On the Apps tab, in the Simulation
Graphics and Reporting section, click Report Generator.
3 Select File > New to create a report setup file.
4 Save the report setup file.
a Specify where to save the report setup file. To save it in the current working folder, select
Present Working Directory from the Directory selection list.
b Specify the report format. In the File format selection list, select Acrobat (PDF).
Tip In your reports, if you want to include hyperlinks in system snapshots, use Direct PDF
(from template) file format.
c Enter a description for the report. In the Report description text box, replace the existing
contents with the following text.
4-50
Create a Simulink Report Generator Report Interactively
Tip Copy and paste this code from the HTML documentation into the Report Explorer.
The Outline pane on the left displays the new file name.
To create the content for the report, see “Add Report Content with Components” on page 4-51.
4-51
4 Creating Simulink Reports
Report Components
Report components specify what information to include in the report. Components are self-contained,
modular MATLAB objects that control the report-generation process and insert elements, such as
tables, lists, and figures, into a report setup file. Use components to customize the appearance and
output of reports.
The following figure shows a sample page from the report you create in this example, and which
components you use to produce this output.
Note Do not deactivate report components that you add to the report setup file.
4-52
Create a Simulink Report Generator Report Interactively
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
The first component to add is the Evaluate MATLAB Expression component, which evaluates
MATLAB commands in the workspace. The code in this component assigns initial values to variables
used in this example.
2 In the Library pane in the middle, under the MATLAB category, select Evaluate MATLAB
Expression.
3 In the Properties pane on the right, click the icon next to Add component to current report to
insert the component into the report.
Note You cannot edit the component information in the Properties pane on the right until you
add the component to the report.
In the Outline pane on the left, the Evaluate MATLAB Expression component appears under
the simulink_tutorial report setup file. The Simulink Report Generator software abbreviates
the component name to Eval.
The icon in the upper left corner of the Eval component icon indicates that this component
cannot have child components. By default, any components you add while the Eval component is
selected are siblings of this component.
The options for the Evaluate MATLAB Expression component appear in the Properties pane on
the right.
4-53
4 Creating Simulink Reports
4 Clear the Insert MATLAB expression in report and the Display command window output
in report check boxes so you do not include MATLAB code or output in this report.
5 Add MATLAB code to the Expression to evaluate in the base workspace text box to specify
the following values:
4-54
Create a Simulink Report Generator Report Interactively
expParam='Gain';
testMin=2.1;
testMax=3;
try
open_system(expModel);
end
expOkValues=cell(0,2);
Note When you change a field in the Properties pane on the right, the field background changes
color (the default is a cream color), indicating that there are unapplied changes to that field. As
soon as you perform operations on another component, the Simulink Report Generator software
applies the changes, and the background color becomes white again.
6 Select the Evaluate this expression if there is an error check box.
7 In the field under the check box, replace the existing text with the following text:
4-55
4 Creating Simulink Reports
Tip To run the commands that you specified in your MATLAB expression, click the Eval Now
button. This button is located at the upper-right corner of the Report Explorer. This is an easy
way to ensure that your commands are correct and will not cause report generation problems.
8 Click File > Save to save the report setup file.
For information about handling error conditions, see “Error Handling for MATLAB Code”.
4-56
Create a Simulink Report Generator Report Interactively
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
Create a custom title page for your report using the Title Page component.
2 In the Library pane in the middle, under the Formatting category, click Title Page.
Note To use the Title Page component, you need to have a Chapter component in your report .
You have not yet added a Chapter component, so the Properties pane displays a message
indicating that chapters are required for the Title Page component to appear correctly. Because
later in this example you add Chapter components to this report, you can ignore that message.
4 In the Properties pane on the right:
4-57
4 Creating Simulink Reports
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
The following statement in the Evaluate MATLAB Expression component that you created in “Add
MATLAB Code” on page 4-53 tries to open the slrgex_vdp model:
try
open_system(expModel);
end
Tip Select the Eval component in the Outline pane on the left to look at this code again.
To see if the slrgex_vdp model was successfully opened, test the result of the open_system
command using a Logical If component.
4-58
Create a Simulink Report Generator Report Interactively
1 In the Outline pane on the left, select the Title Page component.
2 In the Library pane in the middle, under the Logical and Flow Control category, select Logical
If. This component checks to see if a given condition is true or false; in this case, if the model
opened successfully.
3 In the Properties pane on the right, click the icon next to Add component to current report.
The Logical If component appears as if in the Outline pane.
These components are child components of the report and siblings of one another. Components
can have parent, child, and sibling relationships.
This component can have child components. “Add Logical Then and Logical Else Components” on
page 4-60 explains how to add two child components to the if component.
4 In the Properties pane on the right, in the Test expression text box, replace the default text,
true, with the following text:
strcmp(bdroot(gcs),expModel)
The strcmp function compares the name of the open Simulink model and the value of expModel,
which was set to 'slrgex_vdp'. It tests to see if the slrgex_vdp model opened successfully.
strcmp returns 1 (true) if the two strings match, and 0 (false) if not.
5 Save the report setup file.
The if component name in the Outline pane changes to include the expression that you added.
4-59
4 Creating Simulink Reports
To see the completed report setup file, open the simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
The if strcmp(bdroot(gcs), expModel) component has two possible results. Add two child
components to the report setup file to process these cases.
2 In the Library pane in the middle, under the Logical and Flow Control category, double-click
Logical Then.
3 In the Outline pane on the left, select the if component again.
4 In the Library pane in the middle, under the Logical and Flow Control category, double-click
Logical Else.
Both elements are added as child components to the if component, as shown in the Outline pane.
5 To move the else component under the then component, select the else component and click the
down arrow on the toolbar once. The Outline pane on the left looks as follows.
4-60
Create a Simulink Report Generator Report Interactively
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
2 In the Library pane in the middle, under the Formatting category, double-click Chapter/
Subsection to add it as a child of the else component. This component displays an error
message if an error occurs when opening the slrgex_vdp model.
4-61
4 Creating Simulink Reports
Note When you add a component to a report, it is added by default as a child component unless
the selected component cannot have child components.
3 In the Properties pane on the right, choose Custom from the Title selection list, and then enter
the following text in the text box:
The expression %<expModel> indicates that the value of the workspace variable expModel is
inserted into the text, as in the following example.
4-62
Create a Simulink Report Generator Report Interactively
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
Creating the body of the report involves setting up components and code for dynamic execution of
report components. In this example, you perform the following tasks:
Each action requires a separate component under the then component. For information about the
then component in this report, see “Add Logical Then and Logical Else Components” on page 4-60.
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
4-63
4 Creating Simulink Reports
The report changes the Gain parameter for the Mu block in the slrgex_vdp model several times.
This task requires a Model Loop component.
4-64
Create a Simulink Report Generator Report Interactively
e Select the Display the object type in the section title check box to include the object type
(in this example, model) in the title name.
f Clear the Create link anchor for each object in loop check box.
4 Save the report setup file.
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
In each Model Loop Chapter, add an explanation using the Paragraph component.
1 In the Outline pane on the left, select the Model Loop Chapter component.
2 In the Library pane in the middle, scroll up to the Formatting category, and then double-click
Paragraph. The Paragraph component is added as a child of the Model Loop Chapter
component.
3 In the Properties pane on the right, in the Paragraph Text text box, enter the following text:
This report demonstrates Simulink Report Generator's ability
to experiment with Simulink systems and auto-document
4-65
4 Creating Simulink Reports
When this report is generated, the variable names, preceded by percent signs (%) and enclosed in
angle brackets (<>), are replaced with the values of those variables in the MATLAB workspace.
4 Save the report setup file.
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
Inside each Model Loop Chapter component, include a snapshot of the current model using the
System Snapshot component.
1 In the Outline pane on the left, select the Model Loop Chapter component.
2 In the Library pane in the middle, scroll down to the Simulink category, and then double-click
the System Snapshot component.
This component inserts an image of the current model into your report. The Properties pane on
the right looks as follows.
4-66
Create a Simulink Report Generator Report Interactively
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
Create a loop to process the model %length times using the For Loop component.
1 In the Outline pane on the left, select the System Snapshot component.
2 In the Library pane in the middle, under the Logical and Flow Control category, double-click
For Loop. The For Loop component is added as a sibling of the System Snapshot component.
a In the End text box, replace the existing text with the following text:
length(expValue)
expValue is the array of Gain parameter values assigned in the Eval component with the
command expValue=[-1 0 0.5 1 2];. The expression length(expValue) evaluates to
5 in this example.
b In the Variable name text box, replace the existing text with the name of the for loop
variable. Enter the following text:
expIteration
4-67
4 Creating Simulink Reports
The name of the For component in the Outline pane on the left changes to reflect the loop
variable and the termination value.
4 Save the report setup file.
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
For each iteration, get a value from the expValue array to use as the Gain parameter value. This
task requires an Evaluate MATLAB Expression component.
a Clear the Insert MATLAB expression in report and Display command window output
in report check boxes.
b Enter the following text in the Expression to evaluate in the base workspace text box:
if iscell(expValue)
Iteration_Value=expValue{expIteration};
else
Iteration_Value=...
num2str(expValue(expIteration));
end
4-68
Create a Simulink Report Generator Report Interactively
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
Create a separate section for each iteration of the loop that includes the data using the Chapter/
Subsection component.
1 In the Outline pane on the left, under the for component, select the Eval component.
2 In the Library pane in the middle, under the Formatting category, double-click Chapter/
Subsection to add it as a sibling. This component is automatically added as Section 1 because it
is inside a Chapter component (the Model Loop Chapter component).
This indicates that the section title comes from the first child component. Do not change any
other properties.
4 Save the report setup file.
4-69
4 Creating Simulink Reports
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
For each iteration, set the Gain parameter to the value that you extracted from the expValue array.
4-70
Create a Simulink Report Generator Report Interactively
3 In the Properties pane on the right, clear the Insert MATLAB expression in report and
Display command window output in report check boxes.
4 In the Expression to evaluate in the base workspace text box, replace the existing text with
the following text.
set_param(expBlock,expParam,Iteration_Value);
okSetValue=(1);
The set_param command sets the value of the Gain parameter for the Mu block in the
slrgex_vdp model to the value of Iteration_Value.
5 Make sure you select Evaluate this expression if there is an error. Enter the following text
into the text box:
okSetValue=logical(0);
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
4-71
4 Creating Simulink Reports
setedit simulink-dynamic.rpt
Check the value of okSetValue using a Logical If component. If the value is 0, the simulation
cannot proceed because the Gain parameter could not be set.
1 In the Outline pane on the left, select the Eval component for the set_param command.
2 In the Library pane in the middle, under the Logical and Flow Control category, double-click
Logical If. The component is added as a sibling of Eval.
3 In the Properties pane on the right, in the Test expression text box, replace true with
okSetValue.
okSetValue can be 1 (true) or 0 (false), so insert two components — Logical Then and Logical
Else — to process those conditions:
a In the Library pane in the middle, double-click the Logical Else component.
b Select the if (okSetValue) component again.
c Double-click the Logical Then component. The Outline pane on the left looks as follows.
4-72
Create a Simulink Report Generator Report Interactively
If okSetValue = 0, the Gain parameter value is not set and the report displays an error.
5 In the Properties pane on the right:
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
Now that the model is open and the Gain parameter is set, use the Model Simulation component to
simulate the slrgex_vdp model.
1 In the Outline pane on the left, select the then component under the if (okSetValue)
component.
2 In the Library pane, under the Simulink category, double-click Model Simulation. In the
Outline pane on the left, this component is renamed Simulate model.
4-73
4 Creating Simulink Reports
a Clear the Use model's workspace I/O variable names check box.
b In the Time text box, enter dynamicT.
c In the States text box, enter dynamicX.
d In the Output text box, enter dynamicY.
4-74
Create a Simulink Report Generator Report Interactively
4 In the Outline pane on the left, select the Simulate model component.
5 In the Library pane in the middle:
4-75
4 Creating Simulink Reports
a In the Outline pane on the left, select the Scope Snapshot component.
b In the Library pane in the middle, scroll up to the Logical and Flow Control category.
c Double-click the Logical If component.
9 To test the signal data, replace true in the Test expression text box with the following in the
Properties pane on the right:
4-76
Create a Simulink Report Generator Report Interactively
11 If this condition is true, the signal data falls within the desired range. Add a Paragraph
component to print information about the signal data in the report.
a In the Outline pane on the left, select the if component you just added.
b In the Library pane in the middle, under the Formatting category, double-click Paragraph
so that it becomes a child of the if component.
4-77
4 Creating Simulink Reports
An unintended result occurs: the new component is a child of the Paragraph component.
c To make the new component a sibling of the Paragraph component, in the Outline pane on
the left, select the Eval component, and then Click the left arrow on the toolbar. The Eval
component becomes a sibling of the Paragraph component.
a Clear the Insert MATLAB expression in report and Display command window output
in report check boxes.
b In the Expression to evaluate in the base workspace text box, enter the following to save
the desired signal values in the expOkValues array:
expOkValues=[expOkValues;...
{Iteration_Value,max(dynamicX(:,2))}];
c Make sure you select Evaluate this expression if there is an error. Insert the following
text in the text box:
Note This section builds on the previous tasks. To see the completed report setup file, open the
simulink-dynamic.rpt setup file.
setedit simulink-dynamic.rpt
Now that you have collected all the desired values, create the post-test analysis section by creating a
table and inserting it into your report at the end of this chapter.
1 In the Outline pane on the left, select the Model Loop Chapter component.
2 In the Library pane in the middle, under the Formatting category, double-click Chapter/
Subsection.
4-78
Create a Simulink Report Generator Report Interactively
Click the down arrow three times so Section 1 moves to the end of the Model Loop Chapter
component.
4-79
4 Creating Simulink Reports
The two components are siblings in the Outline pane on the left.
4-80
Create a Simulink Report Generator Report Interactively
i Clear the Insert MATLAB expression in report and Display command window
output in report check boxes.
ii The next component of the report uses the strings Mu Value and Signal Maximum as
table header values. Add the strings to the front of the expOkValues cell array by
entering the following text into the Expression to evaluate in the base workspace
text box:
4-81
4 Creating Simulink Reports
a In the Workspace variable name text box, enter expOkValues. The Simulink Report
Generator software uses the contents of expOkValues to construct the table.
b In the Table title text box, enter Valid Iteration Values.
14 Save the report setup file.
4-82
Create a Simulink Report Generator Report Interactively
1 A Message List window appears, displaying informational and error messages as the report is
processed. Specify the level of detail you would like the Message List window to display while the
report is being generated. Options range from 0 (least detail) to 6 (most detail). Click the
selection list located under the title bar of the Message List window to choose an option.
Message level 3 (Important messages) is used for the remainder of this example.
4-83
4 Creating Simulink Reports
2 The slrgex_vdp model appears. You can see each time it is simulated.
3 The scope window appears. The scope graph changes each time the parameter value changes.
4 Each component of the report is highlighted as it executes, in the Outline pane on the left in the
Report Explorer window.
4-84
Create a Simulink Report Generator Report Interactively
4-85
4 Creating Simulink Reports
Associating a report with a model sets the model parameter ReportName to the name of the report.
Each model can have only one report associated with it. You can associate the same report with more
than one model.
load_system('myModel')
report(get_param('myModel','ReportName'))
bdclose('myModel')
See Also
report
Related Examples
• “Select Report Generation Options”
4-86
Logical and Looping Components
A looping component runs its child components a specified number of times. There are several
looping components, such as logical loops, Handle Graphics loops, and model and chart loops. For
model and chart loops, you can control aspects such as the order in which the report sorts blocks.
For an example that uses loop components, see “Edit Figure Loop Components”.
You can use loop context functions with loop components. For details, see:
4-87
4 Creating Simulink Reports
Use loop context functions to filter the modeling elements to report on and to perform special
reporting on specific elements.
For a summary of loop context functions, see “Loop Context Functions” on page 4-90.
report
3 In the Report Explorer, select File > New.
4 In the Properties pane, set Directory to Present working directory.
5 Save the setup file as inport_outport.rpt.
Add Components
Add these components to the report, in order.
4-88
Filter with Loop Context Functions
The report includes a chapter with properties for the Inport blocks only.
If you wish, create a second chapter that reports on Outport blocks only, as shown below.
4-89
4 Creating Simulink Reports
You can use these loop context functions in similar ways as shown in “Filter with Loop Context
Functions” on page 4-88.
4-90
5
Web Views
Use Web views to share models with people who do not have Simulink installed.
You can save Web views of a model over time, creating snapshots of the model as it changes during
the development process.
System Requirements
Although you use Simulink Report Generator software to create Web views, you can display a Web
view in a browser, even if you do not have Simulink Report Generator installed.
By default, when you export a Web view, that Web view automatically displays in your default Web
browser. Web views require a Web browser that supports SVG natively.
You can choose to export the Web view files as the Web view HTML file and the supporting files, in a
folder, without being zipped. You can open the Web view HTML file directly, without having to open a
non-zipped file. You can also choose to export the Web view files as both a zip file and as non-zipped
files.
The default name of the zip file or folder that contains the non-zipped Web view files is the name of
the model that contains the systems to export. You can specify a different file or folder name.
The default location for storing Web view files is the MATLAB current folder. You can choose a
different folder.
If you send Web view files to someone else, consider whether you need to explain how to access the
Web view file.
See Also
Related Examples
• “Export Models to Web View Files” on page 5-4
• “Display and Navigate a Web View” on page 5-5
• “Create and Use a Web View of a Model” on page 5-12
5-2
Web Views
• “Include Model Requirements and Coverage Data in a Web View” on page 5-18
5-3
5 Export Simulink Models to Web Views
If you select more than one kind of system, the criteria for exporting information for interacting
with the contents of the systems are applied downward through the model hierarchy. For
example, if you did not select Referenced Models when you exported the model, regardless of
how you set the Library Links option, in the web view you cannot interact with a library link
block that is inside of a referenced model.
5 Under Systems to Exclude, select any systems that you do not want to export. To select multiple
systems, press the Ctrl key and select systems.
6 To avoid overwriting existing exported web view packages, select If package exists, increment
name to prevent overwriting.
7 In Package Type, specify whether you want to package the web view as a zipped file (the default
packaging). In Package name, you can specify a name for the zip file or for the folder for the
web view files.
8 Select optional views.
• If you have Simulink Coverage™ installed, on the Optional Views tab, you can select
Include Coverage view.
• If you have Simulink Requirements on the Optional Views tab, you can select Include
Requirements view.
9 Click Export.
See Also
Functions
slwebview
Related Examples
• “Display and Navigate a Web View” on page 5-5
• “Create and Use a Web View of a Model” on page 5-12
• “Include Model Requirements and Coverage Data in a Web View” on page 5-18
• “Web Views” on page 5-2
• “Web View Files” on page 5-2
5-4
Display and Navigate a Web View
• Microsoft Edge®
5-5
5 Export Simulink Models to Web Views
• Internet Explorer® 11
• Google Chrome™
• Firefox®
• Safari
Before you can open a Web view file in a Microsoft Edge or Google Chrome browser, you must set up
the browser to allow the Web view file to access files and subfolders in the Web views folder. The
setup for a Google Chrome browser depends on the platform that you use.
Create a shortcut that opens Microsoft Edge with the --allow-file-access-from-files flag.
Create a shortcut that opens Chrome™ with the --allow-file-access-from-files flag. For
example, on Windows 10:
5-6
Display and Navigate a Web View
1 Run terminal.
2 Enter the following text:
./chromium-browser --allow-file-access-from-files
5-7
5 Export Simulink Models to Web Views
• Click the View All tab and click the thumbnail of a system.
To open a system in a separate tab, press CTRL and click the system.
See Also
Functions
slwebview
Related Examples
• “Create and Use a Web View of a Model” on page 5-12
• “Web Views” on page 5-2
• “Web View Files” on page 5-2
• “Include Model Requirements and Coverage Data in a Web View” on page 5-18
5-8
Search a Web View
Perform a Search
1
In a Web View, at the top of the displayed tab, click the search button .
2 In the search box, enter the search term.
Search strings are case-insensitive. The search treats the string as a partial string.
3 To specify search criteria, click the search criteria button and select the types of model element
you want to search in.
4 Press Enter.
The elements of the model that the search returns appear highlighted. The search results include the
name and parent for each returned element.
5-9
5 Export Simulink Models to Web Views
5-10
Search a Web View
To highlight the model element for a search result, click the search result.
The Object Inspector pane to the right of the model updates to reflect the selected model element
or search result.
5-11
5 Export Simulink Models to Web Views
This example shows how to export a Simulink model to a web view. You can view, navigate, and share
a web view without a Simulink license.
open_system("slrgex_fuelsys");
5-12
Create and Use a Web View of a Model
If you do not specify a folder, by default the Folder text box contains the path of the folder where
you previously exported a web view of the model or the current MATLAB folder.
7 Select the If package exists, increment name to prevent overwriting check box. Selecting
this option ensures that you do not overwrite the web view files if you export multiple web views
from the same model. The web view dialog box now looks like this:
8 Click Export.
• The model viewer pane, which displays the model or selected system. By default, this pane
displays the model or top-level system that you exported.
• The View All tab, which displays diagrams of all the systems.
• The model browser pane, which displays a hierarchical tree of the systems. By default, the model
browser pane is hidden. To open it, click the Hide/Show Model Browser button in the lower-
left corner of the model viewer pane. By default, the model browser displays the top-level systems.
Expand the tree nodes to see all systems in the hierarchy.
5-13
5 Export Simulink Models to Web Views
• The object inspector pane, which lists the parameters or properties of models, systems, blocks or
signals.
• The explorer bar, which displays the path of the displayed system in the model.
You can display a system by selecting the system in the model browser, double-clicking the system in
the model viewer pane, or clicking the diagram of the system on the View All tab.
The tab displays diagrams of all the systems in the slrgex_fuelsys model.
5-14
Create and Use a Web View of a Model
2 Click the third diagram in the top row, which is the diagram of the Engine Gas Dynamics
system.
The model viewer pane displays the Engine Gas Dynamics system.
3 Return to the top level of the model by clicking slrgex_fuelsys in the explorer bar.
4 In the model viewer pane, double-click the To Controller system.
The model viewer pane displays the To Controller system, which is a masked SubSystem. You
can interact with the To Controller subsystem because you included masked subsystems
when you exported the model.
5
If the model browser is not open, click the Hide/Show Model Browser button in the lower-left
corner of the model viewer pane.
6 Expand the Engine Gas Dynamics node and click the Mixing and Combustion system.
The Mixing and Combustion system displays in the model viewer pane.
7 Return to the top level of the model by clicking slrgex_fuelsys in the explorer bar.
8 In the model viewer pane, double-click the fuel-rate control system.
The model viewer pane displays the fuel-rate control system, which is a model reference.
You can interact with the fuel-rate control system because you included referenced models
when you exported the model.
5-15
5 Export Simulink Models to Web Views
4 Click the input signal of the Outport block to display the signal properties.
To zoom in and out on the diagram, use the mouse scroll wheel.
5-16
Create and Use a Web View of a Model
See “Web Views” on page 5-2 and “Open a Web View File in a Web Browser” on page 5-5.
See Also
Related Examples
• “Web Views” on page 5-2
• “Include Model Requirements and Coverage Data in a Web View” on page 5-18
• “Export Models to Web View Files” on page 5-4
• “Display and Navigate a Web View” on page 5-5
5-17
5 Export Simulink Models to Web Views
Add Optional Views to a Web View Using the Web View Dialog Box
If you export a model web view from the Simulink Toolstrip, to include requirements or coverage
data:
1 Open the Web View dialog box. In the Simulink Toolstrip, on the Simulation tab, in the File
section, click Save . Under Export Model To, select Web View.
2 Open the Optional Views tab and select the views. By default, both the requirements and
coverage views are selected.
3 Click Export.
• 'requirements'
• 'coverage'
For example:
htmlFileName = slwebview(gcs,'OptionalViews', {'requirements' 'coverage'});
5-18
Include Model Requirements and Coverage Data in a Web View
•
To access the requirements view, click the button. This view highlights model elements that
have requirements and outlines model elements that contain elements that have requirements.
•
To access the coverage data view, click the button. Click model elements for coverage
information.
See Also
Functions
slwebview
Related Examples
• “Export Models to Web View Files” on page 5-4
• “Display and Navigate a Web View” on page 5-5
• “Introduction to Simulink Requirements” (Simulink Requirements)
• “Model Coverage” (Simulink Coverage)
5-19
5 Export Simulink Models to Web Views
In this section...
“What Is Embedded Web View?” on page 5-20
“Navigating an Embedded Web View Report” on page 5-21
“Embedded Web View Packaging” on page 5-23
“View Embedded Web View Reports” on page 5-23
Use the MATLAB Report Generator DOM and Report APIs and the Simulink Report Generator Report
APIs to generate the calibration guide content. Use the Embedded Web View API to create the report.
The report is a user interface with guide content, an embedded Web View, and hyperlinks between
the Web View and the guide report text. The resulting guide runs in any standard browser without
requiring either MATLAB or Simulink.
5-20
Embedded Web View Reports
The Embedded Web View API creates a table of contents (TOC) based on your report section
headings. Clicking a TOC heading entry displays the corresponding report section in the contents
pane. It also displays and flashes the corresponding model element. The linked model block in this
calibration guide example is shown highlighted in yellow in the Web View pane.
This calibration guide has hyperlinks from any text element in the content to any model element in
the Web View pane. Clicking the text element in the contents displays and flashes the corresponding
model element. The linked model block in this calibration report example is shown highlighted in
yellow in the Web View pane.
5-21
5 Export Simulink Models to Web Views
This calibration guide has hyperlinks from any element in the Web View pane to any location in the
report content pane. Clicking the model element displays the corresponding location in the content
pane as shown highlighted in this calibration guide example.
5-22
Embedded Web View Reports
To view an Embedded Web View report on systems that do not have MATLAB installed,
1 Unzip the report in an empty, writable folder on your system. This step creates a file named
webview.html in the folder and a subfolder containing supporting files.
2 Open webview.html in a browser to view the report.
See Also
Related Examples
• “Create an Embedded Web View Report Generator” on page 5-24
5-23
5 Export Simulink Models to Web Views
1 Create a MATLAB class that defines a report object that generates a Web View report. See
“Create an Embedded Web View Report Generator Class” on page 5-24 for a summary of the
steps to create and define the class.
2 To generate the report, use this class in a MATLAB program. See “Generate an Embedded Web
View Report” on page 5-35.
For general information and how to view and navigate a generated report, see “Embedded Web View
Reports” on page 5-20.
end
end
end
4 Replace the placeholder, REPORT_GENERATOR, with the name of your report generator.
5 To save your new class definition file using the name you used to replace the
REPORT_GENERATOR placeholder, select Editor > Save As.
6 To specify the export options and warning suppression option for your report generator, edit the
template constructor. See “Specify Export Options for Embedded Web View Report” on page 5-
25 and “Suppress Link Warning Messages for Embedded Web View Report” on page 5-34,
respectively.
7 To include the report content, table of contents, model, and hyperlinks to embed in your report,
edit the content generator (fillContent) function. These topics describe how to add content to
the Embedded Web View report generator. You can perform these tasks in any order.
• “Specify Document Content for Embedded Web View Report” on page 5-26
• “Generate Table of Contents for Embedded Web View Report” on page 5-27
• “Get Model Objects for Embedded Web View Report” on page 5-28
• “Create Hyperlinks for Embedded Web View Report” on page 5-29
8 Save your changes to the new class definition file.
5-24
Specify Export Options for Embedded Web View Report
For example, the following constructor includes the ExportOptions property. This property exports
the block diagrams of masked subsystems and models and library blocks referenced by the exported
model.
If you export referenced block diagrams, to view them, click the block icon that references the
diagram in the Web View. You can also create hyperlinks from the generated report content to these
block diagrams.
For other tasks to create your Embedded Web View generator, see
• “Specify Document Content for Embedded Web View Report” on page 5-26
• “Generate Table of Contents for Embedded Web View Report” on page 5-27
• “Get Model Objects for Embedded Web View Report” on page 5-28
• “Create Hyperlinks for Embedded Web View Report” on page 5-29
• “Suppress Link Warning Messages for Embedded Web View Report” on page 5-34
To generate the Embedded Web View report, see “Generate an Embedded Web View Report” on page
5-35.
5-25
5 Export Simulink Models to Web Views
function fillContent(rpt)
import mlreportgen.dom.*
import mlreportgen.report.*
add(rpt, TitlePage("Title", "System Design Variable Report"));
...
end
For other tasks to create your Embedded Web View generator, see:
• “Specify Export Options for Embedded Web View Report” on page 5-25
• “Generate Table of Contents for Embedded Web View Report” on page 5-27
• “Get Model Objects for Embedded Web View Report” on page 5-28
• “Create Hyperlinks for Embedded Web View Report” on page 5-29
• “Suppress Link Warning Messages for Embedded Web View Report” on page 5-34
To generate the Embedded Web View report, see “Generate an Embedded Web View Report” on page
5-35.
5-26
Generate Table of Contents for Embedded Web View Report
To use this feature, your report generator fillContent method must use Report API Chapter or
Section objects, or DOM API Heading objects to begin the sections and subsections of the report.
For example:
function fillContent(rpt)
import mlreportgen.dom.*
import mlreportgen.report.*
model = getExportModels(rpt);
model= model{1};
add(rpt, TitlePage("Title", [model " Report"], "Author",""));
finder = slreportgen.finder.ModelVariableFinder(model);
while hasNext(finder)
result = next(finder);
% Create a section for the variable
s = Section(result.Name);
reporter = getReporter(result);
add(s, reporter);
For other tasks to create your Embedded Web View generator, see:
• “Specify Export Options for Embedded Web View Report” on page 5-25
• “Specify Document Content for Embedded Web View Report” on page 5-26
• “Get Model Objects for Embedded Web View Report” on page 5-28
• “Create Hyperlinks for Embedded Web View Report” on page 5-29
• “Suppress Link Warning Messages for Embedded Web View Report” on page 5-34
To generate the Embedded Web View report, see “Generate an Embedded Web View Report” on page
5-35.
5-27
5 Export Simulink Models to Web Views
To find objects to export from the model, use these methods, which are inherited from the
slreportgen.webview.EmbeddedWebViewDocument base class of the report generator.
Method Purpose
getExportModels Get models to be exported to the report as Web
Views.
getExportDiagrams Get block diagrams to be exported to the report
getExportSimulinkSubSystems Get subsystem blocks to be exported to the report
getExportStateflowDiagrams Get Stateflow charts to be exported to the report
getExportStateflowCharts Get Stateflow chart elements to be exported in
this report
This sample code shows how to get a model to use as the Web View.
function fillContent(rpt)
import mlreportgen.dom.*
model = getExportModels(rpt);
model = model{1};
…
end
For other tasks to create your Embedded Web View generator, see:
• “Specify Export Options for Embedded Web View Report” on page 5-25
• “Specify Document Content for Embedded Web View Report” on page 5-26
• “Generate Table of Contents for Embedded Web View Report” on page 5-27
• “Create Hyperlinks for Embedded Web View Report” on page 5-29
• “Suppress Link Warning Messages for Embedded Web View Report” on page 5-34
To generate the Embedded Web View report, see “Generate an Embedded Web View Report” on page
5-35.
5-28
Create Hyperlinks for Embedded Web View Report
methods
function wvdoc = ExampleWebView(reportPath,modelName)
% Invoke the EmbeddedWebViewDocument constructor, which
% saves the report path and model name for use by the
% report's fill methods.
[email protected](reportPath,modelName);
end
function fillContent(wvdoc)
% Fill the Content hole in the report template with design
% variable information. You can use DOM or Report API methods
% to create, format, add, and append content to this report.
n = numel(handles);
for i = 1:n
diagHandle = handles{i};
diagHeading = createDiagramTwoWayLink(wvdoc,diagHandle, ...
mlreportgen.dom.Heading(2,get_param(diagHandle,'Name')));
append(wvdoc,diagHeading);
blockFinder = slreportgen.finder.BlockFinder(diagHandle);
while hasNext(blockFinder)
r = next(blockFinder);
elemHandle = r.Object;
5-29
5 Export Simulink Models to Web Views
append(wvdoc,elemHeading);
end
end
end
end
end
This code creates an embedded web view report for the slrgex_vdp model using the
ExampleWebView class.
model = 'slrgex_vdp';
open_system(model);
wvdoc = ExampleWebView('myReport',model);
open(wvdoc);
fill(wvdoc);
close(wvdoc);
rptview(wvdoc);
1 Click a diagram name in the document pane, for example, More Info. The associated diagram
opens.
5-30
Create Hyperlinks for Embedded Web View Report
2 In the embedded web view, on the More Info tab, click slrgex_vdp.
The slrgex_vdp diagram opens and slrgex_vdp is highlighted briefly in the document pane.
5-31
5 Export Simulink Models to Web Views
3 Click Square in the document pane, the Square block is highlighted in the embedded web view.
4 In the embedded web view, double-click the Mu block. The Mu link in the document pane is
highlighted briefly.
5-32
Create Hyperlinks for Embedded Web View Report
For other tasks to create your embedded web view generator, see:
• “Specify Export Options for Embedded Web View Report” on page 5-25
• “Specify Document Content for Embedded Web View Report” on page 5-26
• “Generate Table of Contents for Embedded Web View Report” on page 5-27
• “Get Model Objects for Embedded Web View Report” on page 5-28
• “Suppress Link Warning Messages for Embedded Web View Report” on page 5-34
To generate an embedded web view report, see “Generate an Embedded Web View Report” on page
5-35.
See Also
slreportgen.webview.EmbeddedWebViewDocument
More About
• “Embedded Web View Reports” on page 5-20
5-33
5 Export Simulink Models to Web Views
For other tasks to create your Embedded Web View generator, see:
• “Specify Export Options for Embedded Web View Report” on page 5-25
• “Specify Document Content for Embedded Web View Report” on page 5-26
• “Generate Table of Contents for Embedded Web View Report” on page 5-27
• “Get Model Objects for Embedded Web View Report” on page 5-28
• “Create Hyperlinks for Embedded Web View Report” on page 5-29
To generate the Embedded Web View report, see “Generate an Embedded Web View Report” on page
5-35.
5-34
Generate an Embedded Web View Report
For example, suppose that you want to create a report using the SystemDesignVariables class
example (see “Class Definition File for an Embedded Web View” on page 5-35). These commands
generate and display an instance of that report:
model = 'f14';
rptName = sprintf('%sVariables', model);
load_system(model);
rpt = SystemDesignVariables(rptName, model);
fill(rpt);
close(rpt);
close_system(model);
rptview(rptName);
The fill(rpt) command uses the fill method, which the report generator inherits from its base
class. This method embeds a Web View of the f14 model in the report. It also calls the fillContent
method of the report generator, which fills the report document pane with a report about the
variables used by the f14 model.
For information on navigating to different parts of the report, see “Navigating an Embedded Web
View Report” on page 5-21.
5-35
5 Export Simulink Models to Web Views
methods
rpt.ExportOptions.IncludeMaskedSubsystems = true;
rpt.ExportOptions.IncludeSimulinkLibraryLinks = true;
rpt.ExportOptions.IncludeReferencedModels = true;
end
function fillContent(rpt)
% Fill the Content hole in the report template with design
% variable information. You can use DOM or Report API methods
% to create, format, add, and append content to this report.
%% Set up report
% Allow use of unqualified names for DOM and Report objects,
% such as Paragraph instead of mlreportgen.dom.Paragraph and
% TitlePage instead of mlreportgen.report.TitlePage.
import mlreportgen.dom.*
import mlreportgen.report.*
% Extract the model from the cell array. (This report uses
% only one model.)
model= model{1};
while hasNext(finder)
result = next(finder);
% Create a section for the variable
s = Section(result.Name);
5-36
Generate an Embedded Web View Report
To generate two-way links between design variable user paths and blocks in the Web View that use
the design variables, replace these lines of code:
5-37
5 Export Simulink Models to Web Views
Web View
• Systems to export (for example, the current system or current system and systems below)
• Whether to export information to support interacting with contents of referenced models, library
links, or masked subsystems
• Where to store the web view files
• How to package the web view files
• Capture and optional view information
See Also
Systems to Export
Select which Simulink systems or Stateflow charts to export.
Note The systems to export are relative to the system that is currently visible in the Simulink Editor
or Stateflow Editor.
5-38
Web View
Referenced Models
Export models referenced by the systems that you select to export. For example, if you select the
Entire Model option, any models referenced by a Model block the exported model.
Library Links
Export library blocks linked to from the systems that you select to export. For example, if you select
the Entire Model option, all library blocks linked to in the exported model.
If you select this option, do not also select the MathWorks Library Links option.
For example, if you select the Entire Model option, all MathWorks library blocks linked to in the
exported model.
If you select this option, along with the Masked Subsystems option, right-clicking a built-in library
block in a web view displays the parameter values for that block.
If you select this option, do not also select the Library Links option.
Masked Subsystems
Allow web view interaction with masked subsystem contents in the systems that you select to export.
Select this option to view the contents of the masked subsystem and open masked subsystem dialog
boxes.
Package name
The default name is the name of the model that contains the systems to export.
If you use the default Package Type setting of Zipped, the Package name field specifies the name
of the zip file.
If you set Package Type to Unzipped, the Package name field specifies the name of the folder.
If the zip file or folder with the specified name in the specified folder already exists, Simulink Report
Generator overwrites the existing zip file or folder contents. To avoid overwriting an existing Web
View files, consider selecting the If package exists, increment name to prevent overwriting
option.
Folder
The folder in which to store the exported web view files. The default folder is the MATLAB current
folder.
Specify a full path to the folder or click Select Folder to navigate to the folder.
5-39
5 Export Simulink Models to Web Views
When you export the Web view the first time, the resulting zip file is called vdp_web_view. If you
export the Web view again, Simulink Report Generator creates a vdp_web_view1.zip file, and
preserves the original vdp_web_view file.
Package Type
Specify the file packaging to use when exporting the Web view.
• Zipped — (Default) Export as a zipped file that includes the Web view file, along with files that
support the display of the Web view. Zip file packaging compresses the files and consolidates the
web view and supporting files into one file.
• Unzipped — Export as the Web view file and supporting files, without being zipped. You can open
an unzipped Web view file directly.
• Both zipped and unzipped— Export as both a zipped file and an unzipped file
Provides additional information about the model, based on the Model Coverage report.
This view provides additional information about the generated code for a block in the web view.
Click a block in the Web view. The generated code for that block appears in the Web Informer pane
below the displayed model.
This option appears only if you have Simulink Requirements software installed.
5-40
Web View
This option appears only if you have Simulink Coverage software installed. You must set up a
coverage report for the model and simulate the model before you can use this option.
5-41
6
Components
For a list of MATLAB Report Generator components, see the MATLAB Report Generator
documentation.
6 Components
Annotation Loop
Run child components multiple times for each Simulink annotation in current context
Description
This component runs its child components multiple times for each Simulink annotation in the current
context. The parent component determines the context.
• Model Loop: Reports on all annotations inside the reported portion of the reported model.
• System Loop: Reports on all annotations inside the current system.
• Block Loop or Signal Loop: Does nothing.
Loop Options
The Loop Options pane displays information about the current context. You can sort
Alphabetically by text or In traversal order.
Child components of the Annotation Loop consider their context to be annotations when the report
is running.
Use a Summary Table component to show annotation objects in reports. Each Summary Table
component creates a single table with each reported annotation on a single row of the table.
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each annotation in the loop
so that other parts of the report can link to it.
See Also
Block Loop, Model Loop, Signal Loop, System Loop, Simulink Linking Anchor,
Simulink Name, Simulink Property, Simulink Property Table, Simulink Summary
Table
6-2
Block Execution Order List
Description
This component creates a list or table of all nonvirtual blocks in the model, showing the order in
which they execute.
For more information about virtual and nonvirtual blocks, see “Nonvirtual and Virtual Blocks”.
Properties
• List Title:
Class
rptgen_sl.csl_blk_sort_list
See Also
Block Loop
6-3
6 Components
Block Loop
Run child components for each block in the current system, model, or signal
Description
This component runs its child components for each block contained in the current system, model, or
signal.
For conditional processing based of blocks, you can use the RptgenSL.getReportedBlock
function. For more information, see “Loop Context Functions” on page 4-90.
Report On
This pane describes the type of object on which this component operates.
• Automatic list from context: Report on all blocks in the current context. The parent
component of the Block Loop determines its context. If this component does not have the Model
Loop, System Loop, Signal Loop, or Block Loop as its parent, selecting this option causes this
component to report on all blocks in all models.
Loop Options
Choose block sorting options and reporting options in this pane.
• Sort blocks:
Use this option to select how to sort blocks (applied to each level in a model):
6-4
Block Loop
• By layout (top to bottom): Sorts blocks by their location in the model layout, by
columns. The block appearing the furthest toward the left top corner of the model is the anchor
for the column. The column contains all other blocks that overlap the vertical area defined by
the left and right edges of the anchor block. The other columns use the same algorithm, using
as the anchor the next unreported block nearest the left top of the model.
• By traversal order. Sorts blocks by traversal order.
• By simulation order. Sorts blocks by execution order.
• %<VariableName>: Inserts the value of a variable from the MATLAB workspace. The %<>
notation can denote a string or cell array. The following example reports on the theta dot
integrator block and the theta integrator block in the model simppend, using the variable
Z={ 'simppend/theta'}:
simppend/theta dot
%<Z>
• simppend/theta dot
• simppend/theta
For more information, see %<VariableName> Notation on the Text component reference
page in the MATLAB Report Generator documentation.
• Search for Simulink property name/property value pairs: Reports only on Simulink blocks
with specified property name/property value pairs.
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each block
found in the loop.
• Display the object type in the section title: Automatically inserts the object type into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each block in the loop so
that other parts of the report can link to it. For example, the image created by a System
Snapshot component can link to the block information only if you select this check box.
6-5
6 Components
Class
rptgen_sl.csl_blk_loop
See Also
Model Loop, Signal Loop, System Loop, Simulink Linking Anchor, Simulink Name,
Simulink Property, Simulink Property Table, Simulink Summary Table
6-6
Block Type Count
Description
This component counts the number of each block type in the current model or system. Within a
model, this component counts blocks underneath masks and inside library links.
For more information about block types, see “Nonvirtual and Virtual Blocks”.
Count Types
The parent of this component determines where to count block types:
Table Content
• Table title: Allows you to enter the table title.
• Show block names in table: Includes a column that displays all block names in the table.
• Sort table:
Class
rptgen_sl.csl_blk_count
See Also
Block Loop, Model Loop, System Loop
6-7
6 Components
Bus
Create list of signals exiting from Bus Selector block
Description
This component creates a list of signals exiting a Bus Selector block. The list contains signals leaving
from the reported block or downstream buses and signals.
The parent of this component determines which buses appear in the report:
If the Bus component does not have a looping component as its parent, it reports on all buses in all
open models.
Properties
• Show Bus Hierarchy: Specifies whether the list displays downstream buses hierarchically.
• Insert linking anchor for bus blocks: Inserts a linking anchor for each bus block. This property
designates the list item as the location to which other links for that block point. (For more
information, see the Simulink Linking Anchor or Link component reference pages.) Do not
use this option if you have already specified an anchor location for the bus block with an Object
Linking Anchor component.
• Insert linking anchor for signals: Inserts a linking anchor for each signal. This property
designates the list item as the location to which other links for that signal point. For more
information, see the Simulink Linking Anchor or Link component reference pages.) Do not
use this option if you have already specified an anchor location for the signal with an Object
Linking Anchor component.
• Title: Inserts a title before each list. This attribute supports the %<varname> notation. For more
information, see %<VariableName> Notation on the Text component reference page in the
MATLAB Report Generator documentation.
Class
rptgen_sl.csl_blk_bus
See Also
Block Loop, Model Loop, Signal Loop, Simulink Linking Anchor, System Loop,
6-8
C Function
C Function
Insert information about C Function block contents
Description
This component displays tables with information about the C code and symbols used by a C Function
block.
• A table that includes the Description parameter and any custom mask parameters
• A table that lists the contents of the Symbols parameter
• Sections for the C code defined by the Output Code, Start Code, and Terminate Code
parameters
You can specify the parameters to report and customize the generated tables.
• Model Loop
• System Loop
• Block Loop
For details about C Function blocks, see the C Function block reference page.
• Determine properties automatically: Let the Report Explorer automatically select the
properties to report. The Report Explorer reports the C Function block parameter dialog box
prompt properties.
• Show properties: Specify a list of properties to report. Enter the names of the C Function
block properties that you want the report to include.
6-9
6 Components
Property names often differ from the Simulink dialog box prompts. To determine the property
names of a C Function block, select the block and enter this code at the MATLAB command
line:
get(gcbh)
• Display property names as prompts: Display the property names as prompts in the generated
report. The report includes the dialog box string instead of the underlying code property.
• Don't display empty values: Exclude the empty parameters in the generated report.
Symbols Table
• Include symbols table: Generate a table with information about the symbols used by the C
Function block.
• Table title: Insert a title for the symbols table.
• Left
• Center
• Right
• Double justified
Class
rptgen_sl.csl_cfcn
See Also
Block Loop, Model Loop, System Loop, MATLAB Function
6-10
Chart Loop
Chart Loop
Run child components for specified Stateflow charts
Description
This component runs its children for specified Stateflow charts.
For conditional processing for a chart, you can use the RptgenSF.getReportedChart function. For
more information, see “Loop Context Functions” on page 4-90.
Report On
• Automatic list from context: Report on all chart blocks in the context set by the parent of
this component.
• Model Loop: Reports on all Stateflow chart blocks in the current model.
• System Loop: Reports on all Stateflow chart blocks in the current system.
• Signal Loop: Reports on all Stateflow chart blocks connected to the current signal.
• Machine Loop: Reports on the current block if it is in a Stateflow chart.
If the Chart Loop component has any other type of component as its parent, selecting this option
causes it to report on all Stateflow chart blocks.
• Custom - use block list: Reports on a specified list of Stateflow chart blocks.
Loop Options
Choose chart block sorting options and reporting options in this pane.
• Sort blocks: Specifies how to sort blocks (applied to each level in a model). This option is
available if you select Automatic list from context in the Report On section, or if you
select Custom - use block list and the Sort blocks option.
6-11
6 Components
• By layout (top to bottom): Sorts blocks by their location in the model layout, by
columns. The block appearing the furthest toward the left top corner of the model is the anchor
for the column. The column contains all other blocks that overlap the vertical area defined by
the left and right edges of the anchor block. The other columns use the same algorithm, using
as the anchor the next unreported block nearest the left top of the model.
• By simulation order. Sorts blocks by execution order.
• %<VariableName>: Inserts the value of a variable from the MATLAB workspace. The %<>
notation can denote a string or cell array. For more information, see %<VariableName>
Notation on the Text component reference page in the MATLAB Report Generator
documentation.
• Search for Simulink property name/property value pairs: Reports on Simulink blocks with
specified property name/property value pairs.
• Search Stateflow: Reports on Stateflow charts with specified property name/property value
pairs.
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each chart in the loop so
that other parts of the report can link to it. For example, the image created by a Stateflow
Snapshot component can link to this information only if you select this check box.
Class
rptgen_sf.csf_chart_loop
See Also
Block Loop, Machine Loop, Model Loop, Signal Loop, System Loop, Simulink Function
System Loop
6-12
Code Generation Summary
Description
This component reports the following information:
Summary
• General information: Includes the following information in the report:
Traceability Report
Use settings from model: When you select this option, the report uses all of the following
configuration settings, as specified in your model. Deselecting this option allows you to turn off one or
more of these settings as needed:
• Eliminated/virtual blocks
• Traceable blocks
• Traceable Stateflow Objects
• Traceable MATLAB Function Blocks
For more information on these configuration settings, see “Model Configuration Parameters: Code
Generation Report” (Simulink Coder).
Class
RptgenRTW.CCodeGenSummary
6-13
6 Components
See Also
Import Generated Code
6-14
Data Dictionary Traceability Table
Description
This component inserts a table into the report. The table links data dictionary information to
corresponding requirements. This component reports on the currently open data dictionary. Place this
component inside a section, paragraph, or table component.
To use this component, your report setup must include Eval statements that open a data dictionary
or determine the data dictionary that is open. To open a template report that shows an example of
these Eval statements, at the MATLAB command prompt, enter:
setedit([matlabroot '/toolbox/slrequirements/+rmide/rmide.rpt'])
Find theEval statements in the if condition at the beginning of the report setup.
Table Options
Specify information about the table.
Table Columns
Specify the table columns that you want to include in the report. The Document name, Locations
within document, and Requirement keyword check boxes correspond to properties on the
Requirements Management Interface Link Editor dialog box.
• Description — Include the description of the requirement. The description helps you to identify
the requirement the table is linking to. Leave this box selected to improve the readability of your
table.
• Document name — Include the name of the document where the requirement is located.
• Locations within document — Include the identifier of a location in the document.
• Requirement keyword — Include the requirement keyword.
Class
RptgenRMI.DDReqTable
6-15
6 Components
See Also
MATLAB Code Traceability Table, Simulink Test Suite Traceability Table, rmi
6-16
Documentation
Documentation
Include content extracted from DocBlock blocks
Description
This component includes DocBlock block content in a report. It can have the following components as
its parent:
• Model Loop
• System Loop
• Block Loop
The way that the DocBlock content is included in a report depends on:
For template-based reports, the report includes the DocBlock content according to this table.
6-17
6 Components
For reports that are not template-based, the report includes the DocBlock content according to this
table.
Note For non-English HTML DocBlock text that you want to include in a Documentation component,
use UTF-8 file encoding. Use a simple text editor to create the HTML code.
Properties
• Import file as: Specifies how to format the imported information. The following example shows
how each option works, using the following text as input:
6-18
Documentation
First row.
Second row.
• Plain text (ignore line breaks). Imports plain text without any line breaks (no
paragraphs), as in this example:
First row. Second row. Third row follows blank line.
• Paragraphs defined by line breaks. Imports the text contained in paragraphs defined
by line breaks (hard returns or carriage returns), as in this example:
First row.
Second row.
• For a PDF report, the report embeds the content or includes an external link to the content,
depending on the value of the EmbedFile option.
• For a Word report, the report includes an external link to the content.
• EmbedFile: Specifies whether to embed the content of the DocBlock block in the generated
report. This option applies only to HTML or RTF content with template-based PDF reports and to
RTF content with template-based HTML reports. If the option is selected, the content is embedded
in the report and a hyperlink to the embedded content is inserted.
6-19
6 Components
Class
rptgen_sl.csl_blk_doc
See Also
Block Loop, Model Loop, Simulink Linking Anchor, System Loop
6-20
Fixed Point Block Loop
Description
This component runs its children for the Simulink model, system, or signal that its parent defines.
Options for the parent component are:
• Model Loop
• System Loop
• Signal Loop
Report On
• Automatic list from context: Reports on all fixed-point blocks in the context of the parent
of this component. For example, if the parent component is the System Loop, then this
component reports on all fixed-point blocks in the current system. If this component does not have
a looping component as its parent, then selecting this option causes the component to report on
all fixed-point blocks in all models.
• Custom - use block list: Reports on a specified list of blocks.
Loop Options
Choose block sorting options and reporting options in this pane.
• Sort blocks: Specifies how to sort blocks (applied to each level in a model). This option is
available if you select the Automatic list from context option in the Report On section, or
if you select Custom - use block list and the Sort blocks options.
6-21
6 Components
• By layout (top to bottom): Sorts blocks by their location in the model layout, by
columns. The block appearing the furthest toward the left top corner of the model is the anchor
for the column. The column contains all other blocks that overlap the vertical area defined by
the left and right edges of the anchor block. The other columns use the same algorithm, using
as the anchor the next unreported block nearest the left top of the model.
• By traversal order. Sorts blocks by traversal order.
• By simulation order. Sorts blocks by execution order.
• %<VariableName>: Inserts the value of a variable from the MATLAB workspace. For more
information, see %<VariableName> Notation on the Text component reference page in the
MATLAB Report Generator documentation.
• Search for Simulink name/property value pairs: Reports only on the fixed-point blocks with
the specified property name-value pairs. To enable searching, click the check box. In the first row
of the property name and property value table, click inside the edit box, delete the existing text,
and type the property name and value. To add a row, click the Add row button.
To find the property names for a block, open the documentation for the block and refer to the
Programmatic Use sections or select a block in the model and enter this code at the MATLAB
command line:
get(gcbh)
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each fixed-point block in
the loop so that other parts of the report can link to it. For example, the image created by a
System Snapshot component can link to this information only if you select this check box.
Class
rptgen_fp.cfp_blk_loop
6-22
Fixed Point Block Loop
See Also
Block Loop, Model Loop, Signal Loop, Simulink Linking Anchor, System Loop
6-23
6 Components
Description
This component sets fixed-point options like those set in the Fixed Point Tool (invoked by running the
fxptdlg function).
This component must be a child of the Model Loop component. Use this component to set the
following options on the current model:
This component can have child components. It is a good practice to use this component with a Model
Simulation component as its child. This approach sets fixed-point properties for the model for the
purpose of the simulation, and then restores them to their original values after the simulation is
complete.
• Use local settings: Logs data according to the value of this parameter set for each subsystem.
Otherwise, settings for parent systems always override those of child systems.
• Min, max, and overflow: Logs minimum value, maximum value, and overflow data for all blocks
in the current system or subsystem.
• Overflow only: Logs only overflow data for all blocks in the current system or subsystem.
• Force off: Logs no data for any block in the current system or subsystem. Use this selection to
work with models containing fixed point-enabled blocks, if you do not have a Fixed-Point Designer
license.
6-24
Fixed Point Logging Options
For more information on logging simulation results, see “Propose Fraction Lengths Using Simulation
Range Data” (Fixed-Point Designer).
Logging Type
Specify how to record logs in this section:
• Overwrite log: Clears information in the logs before new logging data is entered.
• Merge log: Merges new logging data with previously logged information.
Class
rptgen_fp.cfp_options
See Also
Model Simulation
6-25
6 Components
Description
This component inserts a table that reports on Fixed-Point Designer block property name/property
value pairs.
Table
Select a preset table, which is already formatted and configured, in the Preset table list in the
upper-left corner of the attributes page.
• Preset table
• Default
• Mask properties
• Block limits
• Out-of-range errors
• All fixed-point properties
• Blank 4x4
To apply the specified table, select the table and click Apply.
• Split property/value cells: Split property name/property value pairs into separate cells. For the
property name and property value to appear in adjacent horizontal cells in the table, select the
Split property/value cells check box. In this case, the table is in split mode, so there only one
property name/property value pair can exist in a cell. If there is more than one name/property pair
in a cell, only the first pair appears in the report. The report ignores all subsequent pairs.
For the property name and property value to appear together in one cell, clear the Split
property/value cells check box. That option specifies nonsplit mode. Nonsplit mode supports
more than one property name/property value pair and text.
Before switching from nonsplit mode to split mode, make sure that there is only one property
name/property value pair per table cell. If you have more than one property name/property value
pair or text in one cell, only the first value pair appears in the report. Subsequent pairs and text
are omitted.
• Display outer border: Display the outer border of the table in the generated report.
• Table spans page width: Display the table across the entire page in the generated report.
Table Cells
Select table properties to modify. The selection in this pane affects the available fields in the Cell
Properties pane.
6-26
Fixed Point Property Table
Cell Properties
• Contents
Modify the contents of the table cell selected in the Table Cells pane.
• Show as: Specifies the format for the contents of the table cell.
• PROPERTY Value
• Value
• Property Value
• Property: Value
• PROPERTY: Value
• Property - Value
• PROPERTY - Value
• Alignment: Aligns the contents of the table cell.
• Center
• Left
• Right
• Double justified
• Lower border: Displays the lower border of the table in the generated report.
• Right border: Displays the right border of the table in the generated report.
To create a custom table, edit a preset table, such as the Blank 4x4 table. Add and delete rows and
add properties. To open the Edit Table dialog box, click Edit.
For details about creating custom property tables, see “Property Table Components”.
Class
rptgen_fp.cfp_prop_table
See Also
Fixed Point Summary Table
6-27
6 Components
Description
This component displays properties or parameters of specified fixed-point blocks in a table.
Properties
Table title
Property Columns
Property name
This field displays the object properties to include in the Summary Table in the generated report.
• To add a property:
1 Select the appropriate property level in the menu
2 Select the property to add from the selection list and click Add.
• To delete a property, select the property name and click the Delete button.
• To move properties up and down in the list, click the Up and Down buttons.
Note Some entries in the list of available properties (such as Depth) are “virtual” properties that you
cannot access using the get_param command. The properties used for property/value filtering in the
block and system loop components must be retrievable by the get_param. Therefore, you cannot
configure your Summary Table to report on all blocks of Depth == 2.
Transpose table
Enabling this check box changes the summary table rows into columns in the generated report,
putting the property names in the first column and the values in the other columns.
Object Rows
• Insert anchor for each row: Inserts an anchor for each row in the summary table.
• Report On: Specifies blocks on which to report:
• Automatic list from context. Reports on all blocks in the current context.
• Custom - use block list. Reports on a specified list of blocks. To include a given block in
the report, specify its full path.
6-28
Fixed Point Summary Table
Loop Options
• Sort blocks: Specifies how to sort blocks (applied to each level in a model):
• By layout (top to bottom): Sorts blocks by their location in the model layout, by
columns. The block appearing the furthest toward the left top corner of the model is the anchor
for the column. The column contains all other blocks that overlap the vertical area defined by
the left and right edges of the anchor block. The other columns use the same algorithm, using
as the anchor the next unreported block nearest the left top of the model.
• By traversal order. Sorts blocks by traversal order.
• By simulation order. Sorts blocks by execution order.
• Search for Simulink property name/property value pairs: Reports only on Simulink blocks
with specified property name/property value pairs.
Class
rptgen_fp.cfp_summ_table
See Also
Fixed Point Property Table
6-29
6 Components
Description
This component imports source and header files generated by Simulink Coder software. It also
imports custom files that you specify as part of your model.
Properties
• Source files (auto-generated): Includes the following files in the report:
Class
RptgenRTW.CImportCode
See Also
Code Generation Summary
6-30
Look-Up Table
Look-Up Table
Report on lookup table blocks
Description
The Look-Up Table component reports on the following blocks in the Simulink Lookup Tables library.
Some examples of the lookup table blocks include:
The Look-Up Table component inserts a figure and/or table into the report. The table contains input
and output numeric values. A figure plots these values.
Note The Look-Up Table component does not display a table or plot for the Direct Lookup Table (n-D)
block if the block is configured to generate the table during simulation as a block input. Instead, the
Look-Up Table displays a note in the report to the effect that the table is generated dynamically
during simulation.
• The Look-Up Table displays results according to the type of its parent component:
For more information on line and bar plots, see “2-D and 3-D Plots”.
• Create table for 1-D data: Creates a table that contains numeric data values from the 1-D
Lookup Table block.
• Plot 2-D data: Creates a plot of 2-D Lookup Table blocks. You can specify whether the data
appears as a surface plot or a line plot. The line plot is best for small data sets, and the surface
plot for larger tables. For more information on surface and line plots, see “2-D and 3-D Plots”.
6-31
6 Components
Print Options
• Image file format: Specifies the image file format. Select Automatic HG Format (the default)
to choose automatically the format best suited for the output format that you chose in the Report
component. Otherwise, choose an image format that your output viewer can read.
• Automatic SL Format (Uses the Simulink file format selected in the Preferences dialog box)
• Bitmap (16m-color)
• Bitmap (256-color)
• Black and white encapsulated PostScript
• Black and white encapsulated PostScript (TIFF)
• Black and white encapsulated PostScript2
• Black and white encapsulated PostScript2 (TIFF)
• Black and white PostScript
• Black and white PostScript2
• Color encapsulated PostScript
• Color encapsulated PostScript (TIFF)
• Color encapsulated PostScript2
• Color encapsulated PostScript2 (TIFF)
• Color PostScript
• Color PostScript2
• JPEG high quality image
• JPEG medium quality image
• JPEG low quality image
• PNG 24-bit image
• TIFF - compressed
• TIFF - uncompressed
• Windows metafile
• Paper orientation:
• Landscape
• Portrait
• Rotated
• Use figure orientation: Uses the orientation for the figure, which you set with the
orient command.
6-32
Look-Up Table
• Full page image (PDF only): In PDF reports, scales images to fit the full page, minimizes
page margins, and maximizes the size of the image by using either a portrait or landscape
orientation.
For more information about paper orientation, see the orient command in the MATLAB
documentation.
• Image size: Allows you to specify the image size in the report by selecting Use figure
PaperPositionMode setting and setting the PaperPositionMode property of the Handle
Graphics figure.
For more information on paper position mode, see orient in the MATLAB documentation.
• Size: Allows you to enter the size of the Handle Graphics figure snapshot in the format wxh (width
times height). This field is active only if you choose Custom in the Image size list box.
• Units: Allows you to enter for the size of the Handle Graphics figure snapshot. This field is active
only if you choose Custom in the Image size list box.
• Invert hardcopy: Causes the Handle Graphics InvertHardcopy property to invert colors for
printing. In other words, this option changes dark colors to light colors and light colors to dark
colors. To change colors in your image, choose one of the following options:
• Automatic: Automatically changes a dark axes colors to light axes colors. If the axes color is a
light color, this option does not invert the color.
• Invert: Changes dark axes colors to light axes colors, and light axes colors to dark axes
colors.
• Don't invert: Does not change the colors in the image that appears on the screen for
printing.
• Use figure's InvertHardcopy setting: Uses the InvertHardcopy property set in the
Handle Graphics image.
• Make figure background transparent: Makes the image background transparent.
Display Options
• Scaling: Controls size of the image, as displayed in a browser. Making an image larger using this
option does not affect the storage size of the image, but the quality of the displayed image may
decrease as you increase or decrease the size of the displayed image.
Generally, to achieve the best and most predictable display results, use the default setting of Use
image size.
• Use image size: Causes the image to appear the same size in the report as on screen
(default).
• Fixed size: Specifies the number and type of units.
• Zoom: Specifies the percentage, maximum size, and units of measure.
• Size: Specifies the size of the snapshot in the form [width, height] format. This field is active only
if you choose Fixed size in the Scaling selection list.
• Max size: Specifies the maximum size of the snapshot in the form [width, height]. This field is
active only if you choose Zoom from the Scaling selection list.
6-33
6 Components
• Units: Allows you to enter units for the size of the snapshot. This field is active only if you choose
Zoom or Fixed size in the Image size list box.
• Alignment: Only reports in PDF or RTF format support this property.
• Auto
• Right
• Left
• Center
• Title: Enter text to appear above the snapshot.
• Caption: Enter text to appear under the snapshot.
Class
rptgen_sl.csl_blk_lookup
See Also
Block Loop, Model Loop, Signal Loop, System Loop
6-34
Machine Loop
Machine Loop
Run child components for specified Stateflow machines
Description
This component runs its child components for selected Stateflow machines. The behavior of this
component depends on its parent component. If it has no parent, the Machine Loop runs its child
components for all machines. If it has the Model Loop is its parent, it runs its child components for
all machines in the model.
Loop Options
Search Stateflow
If selected, searches states that you specify in the field that appears under the check box.
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each machine in the loop so
that other parts of the report can link to it.
Class
rptgen_sf.csf_machine_loop
See Also
Model Loop
6-35
6 Components
Description
This component runs its child components for each block in the current system, model, or signal that
do not have associated requirements.
For more information on working with looping components, see“Logical and Looping Components”.
Report On
This pane describes the type of object on which this component operates.
• Automatic list from context: Report on all blocks in the current context that do not have
associated requirements. The parent component of the Block Loop component determines its
context. If this component does not have the Model Loop, System Loop, Signal Loop, or Block
Loop as its parent, selecting this option causes this component to report on all blocks in all
models that do not have associated requirements.
• Model Loop: Reports on all blocks in the current model with no associated requirements.
• System Loop: Reports on all blocks in the current system with no associated requirements.
• Signal Loop: Reports on all blocks connected to the current signal with no associated
requirements.
• Custom - use block list: Enables you to specify a list of blocks on which to report. Enter the full
path of each block.
Loop Options
Choose block sorting options and reporting options in this pane.
• Sort blocks:
Use this option to select how to sort blocks (applied to each level in a model):
6-36
Missing Requirements Block Loop
• By layout (top to bottom): Sorts blocks by their location in the model layout, by
columns. The block appearing the furthest toward the left top corner of the model is the anchor
for the column. The column contains all other blocks that overlap the vertical area defined by
the left and right edges of the anchor block. The other columns use the same algorithm, using
as the anchor the next unreported block nearest the left top of the model.
• By traversal order. Sorts blocks by traversal order.
• By simulation order. Sorts blocks by execution order.
• %<VariableName>: Inserts the value of a variable from the MATLAB workspace. The %<>
notation can denote a string or cell array. The following example reports on the theta dot
integrator block and the theta integrator block in the model simppend, using the variable
Z={ 'simppend/theta'}:
simppend/theta dot
%<Z>
• simppend/theta dot
• simppend/theta
For more information, see %<VariableName> Notation on the Text component reference
page in the MATLAB Report Generator documentation.
• Search for Simulink property name/property value pairs: Reports only on the Simulink
blocks with the specified property name-value pairs that do not have associated requirements.
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each block
found in the loop.
• Display the object type in the section title: Automatically inserts the object type into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each missing requirement
in the loop so that other parts of the report can link to it.
6-37
6 Components
Class Name
RptgenRMI.NoReqBlockLoop
See Also
Block Loop, Missing Requirements System Loop, Requirements Block Loop,
Requirements Documents Table, Requirements Signal Loop, Requirements Summary
Table, Requirements System Loop, Requirements Table
6-38
MATLAB Code Traceability Table
Description
This component inserts a table into the report. The table links MATLAB code to corresponding
requirements. This component reports on the currently open .m file. Place this component inside a
section, paragraph, or table component.
To use this component, your report setup must include Eval statements that open a .m file or
determine the .m file that is open. To open a template report that shows an example of these Eval
statements, at the MATLAB command prompt, enter:
setedit([matlabroot '/toolbox/slrequirements/+rmiml/rmiml.rpt'])
Find theEval statements in the if condition at the beginning of the report setup.
Table Options
Specify information about the table.
Table Columns
Specify the table columns that you want to include in the report. The Document name, Locations
within document, and Requirement keyword check boxes correspond to properties on the
Requirements Management Interface Link Editor dialog box.
• Description — Include the description of the requirement. The description helps you to identify
the requirement the table is linking to. Leave this box selected to improve the readability of your
table.
• Document name — Include the name of the document where the requirement is located.
• Locations within document — Include the identifier of a location in the document.
• Requirement keyword — Include the requirement keyword.
Class
RptgenRMI.MlReqTable
6-39
6 Components
See Also
Data Dictionary Traceability Table, Simulink Test Suite Traceability Table, rmi
6-40
MATLAB Function
MATLAB Function
Insert information about MATLAB Function block contents
Description
This component displays tables with information about MATLAB code included in MATLAB Function
blocks. You specify which of the following kinds of information to include in the report:
For details about MATLAB Function blocks, see the MATLAB Function block reference page.
Note To view the contents of a MATLAB Function block in a Web viewer, use the Web view feature of
the Simulink Report Generator. In the Web view, hover your cursor over the MATLAB Function block.
For details, see “Create Model Web Views”.
6-41
6 Components
1 In the table on the right, select a property near where you want to insert the new property
column.
2 From the list of properties to the left of the table, select a property that you want to add to
the table.
3 Click the left-arrow button.
4 If necessary, use the up or down arrow button to position the new column.
• To delete a property column, select the property in the table and click the right-arrow button
• You can change the header text for property and value columns of the table. In the Header
column, double-click to change the header text. The Width column indicates the relative
width, in relative terms, based on the smallest width you specify. For example, for a three-
column table, if the first column width is 1, and the column width of the other two columns is
3, then the second and third columns is three times wider than the first column.
• Grid lines: Show grid lines for the table.
• Spans page width: Make the table as wide as the page.
• Column alignment: Align the text in each column:
• Left
• Center
• Right
• Double justified
6-42
MATLAB Function
Class
rptgen_sl.csl_emlfcn
See Also
Stateflow Property
6-43
6 Components
Description
This component runs its child components for each system or subsystem defined by the parent
component that does not have associated requirements. Insert this component as the child of a
Model Loop component to include systems and subsystems that do not have any associated
requirements in the report.
Report On
• Loop on Systems:
• Select systems automatically: Reports on all systems in the current context that do not have
associated requirements.
If this component does not have any of these components as its parent, selecting this option
reports on all systems in all models that do not have associated requirements.
• Custom - use system list: Reports on a list of specified systems. Specify the full path of each
system.
• %<VariableName>: Inserts the value of a variable from the MATLAB workspace. The %<>
notation can denote a string or cell array. For more information, see %<VariableName>
Notation on the Text component reference page.
Loop Options
• Sort Systems: Specifies how to sort systems.
To find property names for Subsystem blocks, see the Programmatic Use sections for the
parameters in Subsystem, Atomic Subsystem, CodeReuse Subsystem or select a Subsystem block
in the model and enter this code at the MATLAB command line:
6-44
Missing Requirements System Loop
get(gcbh)
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Number sections by system hierarchy: Hierarchically numbers sections in the generated
report. Requires that Sort Systems be set to By traversal order.
• Create link anchor for each object in loop: Create a link target for each missing requirement
in the loop so that other parts of the report can link to it.
Class
RptgenRMI.NoReqSystemLoop
See Also
Block Loop, Missing Requirements Block Loop, Requirements Block Loop,
Requirements Documents Table, Requirements Signal Loop, Requirements Summary
Table, Requirements System Loop, Requirements Table, System Loop
6-45
6 Components
Description
This component inserts a Model Advisor report for the current model into the report if the report is in
HTML format. For other report formats, it inserts a link to a Model Advisor report for the current
model. For more information about Model Advisor reports, see “Save and View Model Advisor Check
Reports”.
Properties
Use existing report: Includes an existing Model Advisor report in the report. This check box is
selected by default. Clearing this option generates a new Model Advisor report.
Class
rptgen_sl.CModelAdvisor
See Also
Model Change Log
6-46
Model Change Log
Description
Run this component before you run the Model Simulation component. It constructs a model history
table that displays information about each logged revision to the model. This model history table
includes:
Tip If your model has a long revision history, consider limiting the number of revisions reported.
Table Columns
Choose the information displayed in the model revision table in this section:
• Author name: Includes the name of the person who last revised the model.
• Version: Includes the version number of the model.
• Date changed: Includes the revision date of the model.
• Description of change: Includes a description of the revision to the model.
Table Rows
• Limit displayed revisions to: Limits the number of revisions that appears in the report.
• Show revisions since date: Limits the number of revisions that appears in the report by date.
Enter the date in the corresponding text field. This field supports %<varname> notation. For
example, the default value, %<datestr(now-14)>, returns revision history for the last two
weeks.
Table Display
Choose how the model revision history table appears in this section.
6-47
6 Components
Class
rptgen_sl.csl_mdl_changelog
See Also
Model Advisor Report
6-48
Model Configuration Set
Description
This component displays a table with the active configuration set for the model.
For information about configurations sets, see “Manage Configuration Sets for a Model”.
Display Options
• Title: Specifies a title for the table in the generated report.
Class
rptgen_sl.csl_mdl_cfgset
See Also
Model Loop, System Loop
6-49
6 Components
Model Loop
Loop on Simulink models and systems, as specified by child components
Description
This component loops on Simulink models and systems, as specified by child components. For
example, you can use a Model Loop with a child System Loop to report on the subsystems of the
specified system.
Consider making these components children of the Model Loop (although the Model Loop is not
necessarily required to be the immediate parent of a given component).
For conditional processing based of blocks, you can use the RptgenSL.getReportedBlock
function. For more information, see “Loop Context Functions” on page 4-90.
Models to Include
You can add a model to the list by clicking Add New Model to List. The following table shows the
buttons you can use to move a model up or down in the list, or to add or delete a model.
Button Action
Move a model up in the list.
Model Options
• Active: Includes a given model in the loop. This option is selected by default. Clearing this option
omits the model from the loop.
This option allows you to temporarily omit one or more models from a report.
• Model name: Specifies the model name.
6-50
Model Loop
• Do not follow Model blocks: Do not report on blocks contained in referenced models.
• Follow all Model blocks: Report on blocks contained in all models that any part of the
model hierarchy references.
• Follow Model blocks defined in current model: Report on blocks in models that the
currently selected model references.
• <Custom model reference depth>: Report on blocks in models that your specified level in
the model hierarchy references.
• Include all variants: Report on all variant models. To enable this option, set the Model
reference option to report on blocks in referenced models.
• Starting system(s): Specifies the system in which to start the loop. Available options depend on
the value that you select in the Traverse model option. Selecting any option other than All
systems in model for Traverse model activates the Starting system(s) option.
If you do not enter a model name in the Model name option, then select either Root model or
Current to specify where to start the loop.
If you specify a model name in the Model name option, then the Starting system(s) option
provides an edit box in which you can enter:
6-51
6 Components
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each model in the loop so
that other parts of the report can link to it.
Examples
Example 6.1. Generating Reports on Specified Systems and Their Subsystems
This example shows how to loop over a specified system and its subsystems in the sample model
sldemo_auto_climate_elec.
openExample('sldemo_auto_climate_elec')
a In the Library pane in the middle, double-click Chapter/Subsection to add it to the report
setup file.
b For Title, choose Custom. In the title field, enter Description of subsystems.
c Add a Model Loop as a child of the Chapter/Subsection component. This loops over the
ClimateControlSystem system and its subsystems in the sldemo_auto_climate_elec
model:
i In the Library pane in the middle, double-click Model Loop to add it to the report setup
file. By default, the Report Explorer adds that component as a child of the Chapter/
Subsection component.
ii In the Model Loop properties pane, from the Model name selection list, select <Custom
block diagram> .
iii In the Model name field, delete the text <Custom block diagram>, and then enter
sldemo_auto_climate_elec.slx. Click any component in the report setup file to add
this model to the Models to include list.
iv In the Traverse model selection list, select Selected system(s) and children.
v In the Look under masks selection list, select All masks.
vi In the Model reference selection list, select Do not follow Model blocks.
vii In the Starting system(s) field, enter sldemo_auto_climate_elec/
ClimateControlSystem. Because you selected Selected system(s) and
6-52
Model Loop
a In the Library pane in the middle, double-click System Loop to add it to the report setup
file. By default, Model Explorer adds this component as a child of the Model Loop
component.
b In the System Loop properties pane, under Loop Options, select the Create section for
each object in loop check box. Selecting this option creates a section in the generated
report for each subsystem on which the component loops. Accept the default values for all
other fields.
8 Add a System Snapshot component as a child of the System Loop component. This step
creates snapshots of all the subsystems of ClimateControlSystem in the generated report. In
the Library pane in the middle, double-click System Snapshot. By default, Model Explorer adds
this component as a child of the System Loop component.
9 Save the report.
6-53
6 Components
6-54
Model Loop
This example shows how to use the Model Loop Active check box to temporarily omit a model from
the loop. This example uses the report setup file that you created in the Generating Reports on
Specified Systems and their Subsystems example above, sldemo_auto_report.rpt, and the f14
model, which is included with Simulink
1 In the Report Explorer, click File > Open, and then open sldemo_auto_report.rpt by double-
clicking it.
2 In the Outline pane on the left, click Model Loop Section 1 -
sldemo_auto_climate_elec.
3
In the Model Loop properties pane, click the button to add a model to the Models to
include list.
4 In the Model Loop properties pane, from the Model name selection list, select <Custom
block diagram>.
5 In the Model name field, delete the text <Custom block diagram> and enter
slrgex_f14.slx.
6 In the Look under masks selection list, select All masks.
6-55
6 Components
The report generation process loops over the specified systems in the slrgex_f14 and
sldemo_auto_climate_elec models, as shown in the following message box.
6-56
Model Loop
The report now includes information only on the sldemo_auto_climate_elec model, as shown
at the end of the previous example, Generating Reports on Specified Systems and their
Subsystems.
12 To reactivate the slrgex_f14 model, in the Model Loop Models to include list, select the
slrgex_f14 model and then select the Active check box.
Class
rptgen_sl.csl_mdl_loop
See Also
Block Loop, System Loop
6-57
6 Components
Model Simulation
Run current model with specified simulation parameters
Description
This component runs the current model using specified simulation parameters. Ensure that this
component has the Model Loop component as its parent.
I/O Parameters
Use model's workspace I/O variable names
Use the names of the parameters specified in the Simulation Parameters dialog box.
The following options are available if you do not select the Use model's workspace I/O variable
names option:
Timespan
Use model's timespan values: Use the model's Start time and Stop time values, as specified in
the Solver tab in the Simulation Parameters dialog box.
The following options are available if you do not select the Use model's timespan values option:
Note If you set the stop time of your model to inf (infinity) in Simulink or on this component
attribute page, Simulink Report Generator terminates the model simulation after 60 seconds.
Terminating the report prevents the report generation process from entering an infinite loop.
Simulation Options
• Compile model before simulation: Compiles the model before simulating, preserving scope
content. Select this option if:
6-58
Model Simulation
Class
rptgen_sl.csl_mdl_sim
See Also
Model Loop
6-59
6 Components
Object Loop
Run child components for Stateflow objects, and then insert table into report
Description
This component runs its child components for each Stateflow object and inserts a table into the
generated report.
For conditional processing of Stateflow objects, you can use the RptgenSF.getReportedObject
function. For more information, see “Loop Context Functions” on page 4-90.
Object Types
• Report on “Data” objects: Includes Stateflow data objects in the loop.
• Report on “Event” objects: Includes Stateflow event objects in the loop.
• Report on “Transition” objects: Includes Stateflow transition objects in the loop.
• Report on “Junction” objects: Includes Stateflow junction objects in the loop.
• Report on “Target” objects: Includes Stateflow target objects in the loop.
• Report on “Annotation” objects: Includes Stateflow note objects in the loop.
• Report on “Port” objects: Includes Stateflow port objects in the loop.
Loop Options
• Report depth: Specifies the level at which to loop:
• Local children only (Default). Reports only on children one level down.
• All objects. Reports on all Stateflow objects.
• Skip autogenerated charts under truth tables: Excludes autogenerated charts under truth
tables from the report.
• Remove objects which do not contain more information than a snapshot: Excludes objects
that contain only a snapshot.
• Search Stateflow: Reports on Stateflow charts with specified property name/property value
pairs.
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Automatically inserts the object type into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each Stateflow object in the
loop so that other parts of the report can link to it.
6-60
Object Loop
Class
rptgen_sf.csf_obj_loop
See Also
Stateflow Filter, Stateflow Hierarchy Loop, Stateflow Hierarchy Loop, Simulink
Function System Loop
6-61
6 Components
Description
This component applies its child components to blocks with associated requirements.
Report On
• Automatic list from context: If selected, this option reports on all blocks in the current
context. The parent of the Requirements Block Loop component determines its context.
• Model Loop: Reports on all blocks with requirements in the current model.
• System Loop: Reports on all blocks with requirements in the current system.
• Signal Loop: Reports on all blocks with requirements connected to the current signal.
If the Requirements Block Loop does not have the Model Loop, System Loop, Signal
Loop, or Block Loop component as its parent, it reports on all blocks in all models.
• Custom - use block list: Reports on a list of blocks with specified requirements. Enter the full
paths of each block into this field.
Loop Options
• Sort blocks
6-62
Requirements Block Loop
• By layout (top to bottom): Sorts blocks by their location in the model layout, by
columns. The block appearing the furthest toward the left top corner of the model is the anchor
for the column. The column contains all other blocks that overlap the vertical area defined by
the left and right edges of the anchor block. The other columns use the same algorithm, using
as the anchor the next unreported block nearest the left top of the model.
• By traversal order: Sorts blocks by traversal order.
• By simulation order: Sorts blocks by execution order.
• Search for Simulink property name/property value pairs: Reports on Simulink blocks with
specified property name/property value pairs that have associated requirements.
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each block
found in the loop that has associated requirements.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each requirement in the
loop so that other parts of the report can link to it.
Class
RptgenRMI.CBlockLoop
See Also
Missing Requirements Block Loop, Missing Requirements System Loop, Model Loop,
Requirements Documents Table, Requirements Signal Loop, Requirements Summary
Table, Requirements System Loop, Requirements Table
6-63
6 Components
Description
This component creates a table that lists all requirements documents linked to model objects.
Table Options
• Show documents linked to
• No title
• Model name (Default)
• Custom
Table Columns
• Replace document paths with links: Inserts links to requirements documents when possible.
• When replacing with links, note absolute vs. relative file path: Indicates absolute or relative
file paths when including links to requirements documents.
• Include document modification time: Includes the document modification information.
• Count # references to each document: Includes a count of the number of references to the
requirements document in the model.
Document References
• Replace file names with document IDs in the main body of the report: Includes shortened
IDs to identify requirements documents to simplify the requirements documents table.
• Retrieve full module path for DOORS links (requires login): This option applies only to
DOORS® requirements. Append the DOORS module ID to the module path in the DOORS database
if the module information is not stored with the model.
6-64
Requirements Documents Table
Class
RptgenRMI.ReqDocTable
See Also
Requirements Summary Table, Requirements Table
6-65
6 Components
Description
The Requirements Signal Loop component applies all child components to signal groups that have
requirements in Signal Builder blocks.
Properties
• Create link anchor for each object in loop: Create a link target for each requirement in the
loop so that other parts of the report can link to it.
• Display the object type in the section title: Inserts the object name with requirements into the
section title.
• Create section for each object in loop: Creates a hyperlink to each object with requirements in
the loop.
• Section Type: Specifies the section type to insert. If you choose Automatic, the Simulink Report
Generator software determines the appropriate section type:
• Book
• Chapter
• Section 1
• Section 2
• Section 3
• Section 4
• Section 5
• Simple Section
• Automatic
Report On
Loops on signal groups in systems:
• Collect all Signal Builders: Processes all Signal Builder blocks, looking for signal groups
with requirements.
• Custom - use list: Processes all subsystems in the user-defined list. If a subsystem on the list
does not have requirements, the Simulink Report Generator software does not include it in the
report.
6-66
Requirements Signal Loop
Class
RptgenRMI.CSystemLoop
See Also
Missing Requirements Block Loop, Missing Requirements System Loop, Requirements
Block Loop, Requirements Documents Table, Requirements Summary Table,
Requirements System Loop, Requirements Table, Signal Loop
6-67
6 Components
Description
This component displays properties of blocks, systems, or Stateflow objects with associated
requirements.
Object Type
Choose the object type to display in the generated report.
• Block (Default)
• System
• Stateflow
The selected object type affects the options available in the Property Columns pane.
Table Title
Specify a table title in the generated report.
Property Columns
• Object properties to include in the Requirements Summary Table appear in a list.
• To add a property:
1 Select the appropriate property level in the text box on the left.
2 In the text box on the right, select the property that you want to add and click Add.
• To delete a property, select the property name and click Delete.
Some entries in the list of available properties (such as Depth) are “virtual” properties that you
cannot access using the get_param command. The properties used for property/value filtering in
the block and System Loop components must be retrievable by the get_param. Therefore, you
cannot configure your Requirements Summary Table to report on all blocks of Depth == 2.
• Remove empty columns: Removes empty columns from the table.
• Transpose table: Changes the summary table rows into columns in the generated report, putting
the property names in the first column and the values in the other columns.
6-68
Requirements Summary Table
Object Rows
• Insert anchor for each row: Inserts an anchor for each row in the Requirements Summary
Table.
• Report On
• Automatic list from context: Reports on all blocks in the current context. The parent of
this component determines its context.
• Custom - use block list: Reports on a list of blocks that you specify, and enters the block
names in the corresponding field. Specify the full path of each block.
Loop Options
Choose block sorting options and reporting options in this pane.
• Sort blocks: Use this option to select how to sort blocks (applied to each level in a model):
• By layout (top to bottom): Sorts blocks by their location in the model layout, by
columns. The block appearing the furthest toward the left top corner of the model is the anchor
for the column. The column contains all other blocks that overlap the vertical area defined by
the left and right edges of the anchor block. The other columns use the same algorithm, using
as the anchor the next unreported block nearest the left top of the model.
• By traversal order: Sorts blocks by traversal order.
• By simulation order: Sorts blocks by execution order.
• Search for Simulink property name/property value pairs: Reports on blocks with specified
property name/property value pairs.
6-69
6 Components
Class
RptgenRMI.CSummaryTable
See Also
Block Loop, Missing Requirements Block Loop, Missing Requirements System Loop,
Requirements Block Loop, Requirements Documents Table, Requirements Signal Loop,
Requirements System Loop, Requirements Table
6-70
Requirements System Loop
Description
This component applies its child components to systems with associated requirements.
Report On
• Loop on systems
• Select systems automatically: If selected, this option reports on all systems in the
current context. The parent of the component determines the context of this setting:
If the Requirement System Loop does not have any of these components as its parent,
selecting this option reports on all systems with requirements in all models.
• Custom - use system list: Reports on a list of specified systems. Enter the full path of
each system.
Loop Options
• Sort Systems:
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Number sections by system hierarchy: Numbers sections in the generated report
hierarchically. Requires that Sort Systems be set to By traversal order.
• Create link anchor for each object in loop: Create a link target for each requirement in the
loop so that other parts of the report can link to it.
6-71
6 Components
Class
RptgenRMI.CSystemLoop
See Also
Missing Requirements Block Loop, Missing Requirements System Loop, Requirements
Block Loop, Requirements Documents Table, Requirements Signal Loop, Requirements
Summary Table, Requirements Table, System Loop
6-72
Requirements Table
Requirements Table
Requirements links for current context
Description
This component creates a table that contains information from the Simulink Requirements software.
Objects can have multiple requirements. Each requirement is a row in the table.
Note If you want to generate a Microsoft Word report, to enable Simulink Requirements hyperlinks
in your report, at the MATLAB command prompt, enter:
rmipref('ReportNavUseMatlab',true)
rmipref('UnsecureHttpRequests',true)
Table Options
• Show requirements for current: Specifies the object type to display.
• Simulink object
• Stateflow object
• Table title: Specifies a title for the table.
• No title
• Object name (Default)
• Custom
Table Columns
• Description: Includes the object description in the table.
• Document name: Includes the report name in the table.
• Locations within document: Includes the locations of the object within the document in the
table.
• Requirement keyword: Includes the requirement keyword for the object in the table.
Class
RptgenRMI.CReqTable
6-73
6 Components
See Also
Missing Requirements Block Loop, Missing Requirements System Loop, Requirements
Block Loop, Requirements Documents Table, Requirements Signal Loop, Requirements
Summary Table, Requirements System Loop, Stateflow Automatic Table, Stateflow
Name
6-74
Scope Snapshot
Scope Snapshot
Insert images of scopes and XY graphs
Description
This component inserts images of scopes and XY graphs. Examples of blocks for which this
component inserts snapshots include:
• Scope (and Floating Scope) blocks and the XY Graph block (Simulink)
• Spectrum Analyzer and Time Scope blocks (DSP System Toolbox™)
• Video Viewer (Computer Vision Toolbox™)
• Blocks in the Simulink Control Design™ Linear Analysis Plots library (for example, the Bode Plot
block)
If the model has not been simulated, scopes are empty. For more information, see the Model
Simulation component reference page.
• Model Loop or no Simulink looping component: Includes all XY graphs and scopes in the current
model.
• System Loop: Includes all XY graphs and scopes in the current system.
• Block Loop: Includes the current block when it is an XY graph or scope.
• Signal Loop: Includes all XY graphs and scopes connected to the current signal.
If the Scope Snapshot does not have any of the Simulink looping components as its parent, it
includes all XY graphs and scopes in all open models.
Scope Options
• Report on closed scopes: Takes a snapshot of all scopes in context. This option forces closed
scopes to open when the report is generating.
• Autoscale time axis: Scales the Simulink scope time axis to include the entire log.
Print Options
• Image file format: Specifies the image file format (for example, JPEG, TIFF, etc.). Select
Automatic HG Format (the default) to choose the format best suited for the specified output
format automatically. Otherwise, choose an image format that your output viewer can read.
• Automatic HG Format (uses the Simulink file format selected in the Preferences dialog box)
• Bitmap (16m-color)
• Bitmap (256-color)
• Black and white encapsulated PostScript
• Black and white encapsulated PostScript (TIFF)
6-75
6 Components
• Landscape
• Portrait
• Rotated
• Use figure orientation: Uses the orientation for the figure, which you set with the
orient command.
• Full page image (PDF only): In PDF reports, scales images to fit the full page, minimizes
page margins, and maximizes the size of the image by using either a portrait or landscape
orientation.
For more information about paper orientation, see the orient reference page in the MATLAB
documentation.
• Image size: Specifies the size of the Handle Graphics figure snapshot in the form [w h] (width,
height). In the units text box, select one of the following options:
• Inches
• Centimeters
• Points
• Normalized
• Invert hardcopy: Inverts colors for printing; changes dark colors to light colors and light colors
to dark colors.
• Automatic: Automatically changes dark axes colors to light axes colors. If the axes color is a
light color, this option does not invert the color.
• Invert: Changes dark axes colors to light axes colors and light axes colors to dark axes colors.
6-76
Scope Snapshot
• Don't invert: Does not change the colors in the image on the screen for printing.
• Use figure's InvertHardcopy setting: Uses the InvertHardcopy property set in the
Handle Graphics image.
• Make figure background transparent: Makes the image background transparent.
Display Options
• Scaling: Controls size of the image, as displayed in a browser. Making an image larger using this
option does not affect the storage size of the image, but the quality of the displayed image may
decrease as you increase or decrease the size of the displayed image.
Generally, to achieve the best and most predictable display results, use the default setting of Use
image size.
• Use image size: Causes the image to appear the same size in the report as on screen
(default).
• Fixed size: Specifies the number and type of units.
• Zoom: Specifies the percentage, maximum size, and units of measure.
• Size: Specifies the size of the snapshot in the form w h (width, height). This field is active only if
you choose Fixed size from the Scaling selection list.
• Max size: Specifies the maximum size of the snapshot in the form w h (width, height). This field is
active only if you choose Zoom from the Scaling selection list.
• Units: Specifies the units for the size of the snapshot. This field is active only if you choose Zoom
or Fixed size in the Image size list box.
• Alignment: Only reports in PDF or RTF format support this property.
• Auto
• Right
• Left
• Center
• Title: Specifies a title for the snapshot figure.
• No caption
• Automatic (use block description). Uses the Simulink block description as the
caption.
• Custom. Specifies a short text description for the snapshot figure.
6-77
6 Components
Class
rptgen_sl.csl_blk_scope
See Also
Block Loop, Model Loop, Signal Loop, System Loop
6-78
Signal Loop
Signal Loop
Run child components for each signal contained in current system, model, or block
Description
The Signal Loop component runs its child components for each signal contained in the current
system, model, or block. The parent component determines the behavior of this component.
For conditional processing of signals, you can use the RptgenSL.getReportedSignal function. For
more information, see “Loop Context Functions” on page 4-90.
Select Signals
• Include block input signals: Loops on signals that feed into blocks. This option is valid only
when the parent component of this component is a Block Loop.
• Include block output signals: Loops on signals that leave the block. This option is valid only
when the parent component of this component is a Block Loop.
• Include system input signals: Loops on signals coming from inports. This option is valid only
when the parent component of this component is a System Loop.
• Include system internal signals: Loops on system internal signals. This option is valid only
when the parent component of this component is a System Loop.
6-79
6 Components
• Include system output signals: Loops on signals going to outports. This option is valid only
when the parent component of this component is a System Loop.
• Sort signals: Specifies how to sort signals:
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Automatically inserts the object type into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each signal in the loop so
that other parts of the report can link to it.
Class
rptgen_sl.csl_sig_loop
See Also
Block Loop, Model Loop, System Loop
6-80
Simulink Automatic Table
Description
This component inserts a two-column table that contains details for the selected model, system,
signal, or block into a generated report.
Options
• Show current: Modeling object to specify properties for.
• Determine properties automatically: Let the Report Explorer automatically select the
properties to report.
Property names often differ from the Simulink dialog box prompts. Refer to the Simulink
documentation to determine property names for blocks, signals, and other modeling objects.
You can also use the MATLAB get command to determine the property names of an object. For
example, to determine the property names of the block currently selected in a model, enter the
following at the MATLAB command line:
get(get_param(gcb,'Handle'))
• Show full path name: Displays the full path of the selected Simulink model.
• Display property names as prompts: Displays property names as prompts in the generated
report. The report includes the dialog box string instead of the underlying code property.
6-81
6 Components
Display Options
• Table title: Displays a table title in the generated report.
Class
rptgen_sl.csl_auto_table
See Also
Block Loop, Model Loop, Signal Loop, System Loop
6-82
Simulink Data Dictionary
Description
This component reports on the data dictionary currently active in the data dictionary loop specified
by the Data Dictionary Loop component. Include this component as a child of a Simulink Data
Dictionary Loop component.
Presentation Format
The report for a data dictionary includes a table that summarizes the properties of each variable in
the dictionary. The report also includes a dictionary details section that fully reports the properties
and value of each variable in the dictionary. If you use a conversion template to generate the report,
you can specify template-defined styles for the summary table title and the summary table.
To use a conversion template, in the Report Options dialog box, set File format to one of the from
template options, for example, Direct PDF (from template).
• Table title style name: Specifies the style to use for the data dictionary table title. To specify the
default style name rgTableTitle, which the default conversion template defines, use Auto. To
specify a custom style defined in a custom template that you use with this report, select Specify.
• Table style name: Specifies the style to use for the data dictionary table. To specify the default
table style name rgUnruledTable, which is the default conversion template defines, use Auto.
To specify a custom style defined in a custom template that you use with this report, select
Specify.
Options
You can specify whether to include dictionaries referenced by a dictionary and how to present the
referenced information.
• Include referenced data dictionaries: Includes information from the data dictionaries that the
dictionary currently active in the data dictionary loop specified by the Data Dictionary Loop
component references. The referenced information displays at the end of the table for the
referencing data dictionary, unless you select Make separate table for each referenced
dictionary.
• Make separate table for each referenced dictionary: If you select Include referenced data
dictionaries, display a table for each referenced data dictionary.
• Include referenced dictionaries list: If you select Include referenced data dictionaries,
following the referencing data dictionary summary table, include a list of the referenced data
dictionaries.
Sections to Report
You can specify the data dictionary sections to include data for.
6-83
6 Components
• Design Data (default): Include information from the Design Data section of the current data
dictionary.
• Configuration: Include information from the Configuration section of the current data dictionary.
• Other Data: Include information from the Other Data section of the current data dictionary.
Fields to Report
The current dictionary summary table lists properties of the variables that it contains. The table
always includes the variable name and value. In addition, it optionally includes these properties:
• Data type
• Last modified
• Last modified by
• Status
• Referenced dictionary that contains data
Example
Suppose that you configure an HTML report with the Simulink Data Dictionary Loop component.
6-84
Simulink Data Dictionary
6-85
6 Components
Class
rptgen_sl.csl_data_dictionary
See Also
Simulink Data Dictionary Loop
6-86
Simulink Data Dictionary Loop
Description
This component runs the Simulink Data Dictionary child component for each Simulink data dictionary
in the specified context. You can specify whether to have each data dictionary in the loop.
Report on
Specify the data dictionaries to report on.
• Dictionaries in MATLAB path: Report on all data dictionaries on the MATLAB path. If you
select Include child data dictionaries, then also reports on child data dictionaries whose parent
is on the MATLAB path.
• Dictionaries in list: Report on all data dictionaries that you specify in the text box. Enter
data dictionary names, separated by either a comma or semicolon. You can use multiple lines. If
you do not specify the full path to a data dictionary, the loop includes that data dictionary only if
the dictionary is on the MATLAB path.
Use a Summary Table component to show annotation objects in reports. Each Summary Table
component creates a single table with each reported annotation on a single row of the table.
Section Options
Create section for each object in loop: Create a separate chapter for each data dictionary.
Example
Suppose you have an HTML report with the Simulink Data Dictionary Loop component configured
like this:
6-87
6 Components
Then you configure the Simulink Data Dictionary component like this:
6-88
Simulink Data Dictionary Loop
Class
rptgen_sl.csl_data_dict_loop
See Also
Simulink Data Dictionary
6-89
6 Components
Description
This component takes snapshots of Simulink editor dialog boxes. You use it to display the current
settings associated with an object or document the appearance of your custom mask dialog boxes.
The parent component of this component determines the behavior of this component.
• Block Loop: Documents the dialog box of the current reported block.
• System Loop: Documents the dialog box of the current reported system.
Format
• Image file format: Specifies the format for the snapshot image file. The automatic format
chooses BMP format for PDF files, and PNG for other formats.
• Show all tabs: Automatically generates images for all the tabs for the dialog box. If you clear this
check box, Simulink Report Generator creates an image of only the first tab.
Display Options
• Scaling: Controls size of the image, as displayed in a browser. Making an image larger using this
option does not affect the storage size of the image, but the quality of the displayed image may
decrease as you increase or decrease the size of the displayed image.
Generally, to achieve the best and most predictable display results, use the default setting of Use
image size.
• Use image size: Causes the image to appear the same size in the report as on screen
(default).
• Fixed size: Specifies the number and type of units.
• Zoom: Specifies the percentage, maximum size, and units of measure.
• Size: Specifies the size of the snapshot in the format w h (width, height). This field is active only if
you choose Fixed size from the Scaling selection list.
• Max size: Specifies the maximum size of the snapshot in the format w h (width, height). This field
is active only if you choose Zoom from the Scaling selection list.
• Units: Specifies the units for the size of the snapshot. This field is active only if you choose Zoom
or Fixed size in the Image size list box.
• Alignment: Only reports in PDF or RTF format support this property.
• Auto
• Right
• Left
• Center
6-90
Simulink Dialog Snapshot
Class
rptgen_sl.CDialogSnapshot
See Also
Block Loop, System Loop
6-91
6 Components
Description
This component loops over the Simulink systems that implement a Stateflow Simulink Function
object, including the function’s parent system, subsystems, and optionally the systems that implement
Simulink Functions nested in this function. This component must be a descendant of a State Loop
component that is descendant of a Chart Loop component. This component executes when the
current object in the state loop is a Simulink Function. For example, this structure creates a snapshot
of each Simulink Function in a chart followed by snapshots of the systems that implement the
function:
Report On
Include subsystems in nested Simulink functions: Specifies whether to include subsystems in
nested Simulink functions. By default, this option is enabled.
Loop Options
• Sort Systems: Specifies how to sort systems.
To find property names for Subsystem blocks, see the Programmatic Use sections for the
parameters in Subsystem, Atomic Subsystem, CodeReuse Subsystem or select a Subsystem block
in the model and enter this code at the MATLAB command line:
get(gcbh)
6-92
Simulink Function System Loop
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Number sections by system hierarchy: Hierarchically numbers sections in the generated
report. Requires that Sort Systems be set to By traversal order.
• Create link anchor for each object in loop: Create a link target for each Simulink Function
system in the loop so that other parts of the report can link to it.
Class
rptgen_sl.csl_sys_loop
See Also
Object Loop, State Loop, Chart Loop, System Loop, Block Loop, Model Loop, Signal
Loop
6-93
6 Components
Description
This component creates a table that displays workspace variables and MATLAB functions used by
blocks in a Simulink model. The Model Loop component specifies the current model and systems in
which the blocks appear. For example, suppose a Simulink Gain block has a string cos(x) instead of
a number. The Simulink software looks for a variable x in the workspace and uses the cos function.
Functions
• Include table of functions: Includes a table of Simulink functions in the generated report.
• Table Title: Specifies a title for the table in the generated report:
Variables
• Include table of variables: Includes a table of Simulink variables in the generated report.
• Table title: Specifies a title for the table in the generated report.
In the following table, if any of the entries in the first column are on, the component looks for the
variable listed in the second column. If the component finds the variable in the workspace, it
includes it in the report.
6-94
Simulink Functions and Variables
Large arrays may appear as [MxN CLASS]. For example, if you have a 300-by-200 double array, it
appears in the report as [300x200 DOUBLE].
• Storage class: Include the storage class of the reported variable.
The title of this column is Storage Class. This option looks at the model's TunableVars property
to see if any of the model variables specify their storage class. If you specify the storage class,
TunableVarsStorageClass and TunableVarsTypeQualifier appear in a table column in the
model variables table.
• Exported Global
• Auto
• ImportedExtern
• ImportedExtern Pointer
• Data object properties: For variables that are Simulink.Parameter data objects, includes the
values of the object properties that you list in the edit box.
Example
This table is an example of a table created by the Model Variables component. This Property Table
reports on the variables in the Controller in the f14 model.
6-95
6 Components
Class
rptgen_sl.csl_obj_fun_var
See Also
Block Loop, Model Loop, Signal Loop, System Loop
6-96
Simulink Library Information
Description
This component inserts a table that lists library links in the current model, system, or block.
Table Columns
• Block: Includes the Simulink block name in the generated table.
• Library: Includes the Simulink library root name in the generated table.
• Reference block: Includes the Simulink reference block name in the generated table.
• Link status: Includes the link status in the generated table.
Display Options
• Title: Specifies a title for the generated report.
• Sort table by:
Example
This example uses the aero_guidance model, which you can open by using openExample.
openExample('aero_guidance');
If you set Sort table by to Reference Block and clear the Merge repeated rows check box,
Report Explorer generates this table for the aero_guidance model.
6-97
6 Components
If you select Merge repeated rows, Report Explorer collapses the rows in the Block column so that
each row in the Reference Block column is unique.
6-98
Simulink Library Information
Class
rptgen_sl.CLibinfo
See Also
Block Loop, Model Loop, System Loop
6-99
6 Components
Description
This component designates a location to which links point. Use the Model Loop, System Loop,
Block Loop, or Signal Loop component as the parent component for this component.
Properties
• Insert text: Specifies text to appear after the linking anchor.
• Link from current: Sets the current model, system, block, or signal as the linking anchor.
• Automatic: Automatically selects the appropriate model, system, block, or signal as a linking
anchor. If the Model Loop component is the parent component, the linking anchor is set on
the current model. Similarly, if the Block Loop or Signal Loop is the parent component, the
linking anchor is inserted for the current system, block, or signal, respectively.
• Model: Sets the linking anchor to the current model.
• System: Sets the linking anchor to the current system.
• Block: Sets the linking anchor to the current block.
• Annotation: Sets the linking anchor to the current annotation.
• Signal: Sets the linking anchor to the current signal.
Note Use only one anchor per report each object. For more information, see the Simulink
Summary Table component reference page.
Class
rptgen_sl.csl_obj_anchor
See Also
Block Loop, Model Loop, Signal Loop, System Loop
6-100
Simulink Name
Simulink Name
Insert name of a Simulink model, system, block, or signal into report
Description
This component inserts the name of a Simulink model, system, block, or signal into the report.
Using this component as the first child component of a Chapter/Subsection component allows the
current Simulink model, system block, or signal name to be the chapter or section title.
Properties
• Object type
• Automatic: Automatically selects the appropriate model, system, block, or signal name as the
Simulink object name to include in the report. If the Model Loop component is the parent
component, the object name is the current model name. If the System Loop, Block Loop, or
Signal Loop is the parent component, then the object name is the name of the current system,
block, or signal, respectively.
• Model: Includes the current model name in the report.
• System: Includes the current system name in the report.
• Block: Includes the current block name in the report.
• Signal: Includes the current signal name in the report. If the signal name is empty, the signal
<handle>, which is a unique numerical identifier to that signal, appears in the report.
• Annotation: Includes the current annotation name in the report.
• Display name as: Display the Simulink object name in the report.
Class
rptgen_sl.csl_obj_name
6-101
6 Components
See Also
Chapter/Subsection
6-102
Simulink Property
Simulink Property
Insert property name/property value pair for current Simulink model, system, block, or signal
Description
This component inserts a single property name/property value pair for the current Simulink model,
system, block, or signal.
• System
• Model
• Block
• Signal
• Annotation: Reports annotation content as plain text for web (HTML), Acrobat (PDF), and
Word Document (rtf) output types or as formatted text for other output types.
• System parameter name: Specifies a Simulink parameter name to include in the generated
report:
• If you select Model for Object type, this option appears as Model parameter name.
• If you select Block for Object type, this option appears as Block parameter name.
• If you select Signal for Object type, this option appears as Signal parameter name.
• If you select Annotation for Object type, the Signal parameter name field does not appear.
Display Options
These display options appear for every Object type, except Annotation.
6-103
6 Components
Class
rptgen_sl.csl_property
See Also
Block Loop, Model Loop, System Loop
6-104
Simulink Property Table
Description
This component inserts a table that reports on model-level property name/property value pairs.
Properties
Select Object: Choose the object for the Property Table in the generated report.
• Model
• System
• Block
• Signal
• Annotation
For more information about selecting object types in Property Table components, see “Select Object
Types”.
Table
Select a preset table, which is already formatted and set up, in the preset table list in the upper-left
corner of the attributes page.
• Default
• Simulation Parameters
• Version Information
• Simulink Coder Information
• Summary (req. Simulink Coder)
• Blank 4x4
For the property name and property value to appear together in one cell, clear the Split
property/value cells check box. That setting specifies nonsplit mode. Nonsplit mode supports
more than one property name/property value pair and text per cell.
Before switching from nonsplit mode to split mode, make sure that there is only one property
name/property value pair per table cell. If there is more than one property name/property value
6-105
6 Components
pair or text per cell, only the first property name/property value pair appears in the report. The
report omits subsequent pairs and text.
• Display outer border: Displays the outer border of the table in the generated report.
• Table Cells: Specifies table properties to modify. The selection in this pane affects available fields
in the Cell Properties pane.
Cell Properties
The options in this pane depend on the object selected in the Table Cells pane. If you select %<Name>
Information, only Contents and Show appear. If you select any other object in the Table Cells
pane, Lower border and Right border display.
• Contents: Enables you to change the contents of the table cell selected in the Table Cells pane.
• Show as: Specifies the format for the contents of the table cell.
• Value
• Property Value
• PROPERTY Value
• Property: Value
• PROPERTY: Value
• Property - Value
• PROPERTY - Value
• Alignment: Specifies the alignment of the contents of the selected table cell in the Table Cells
pane.
• Left
• Center
• Right
• Double justified
• Lower border: Displays the lower border of the table in the generated report.
• Right border: Displays the right border of the table in the generated report.
To create a custom table, edit a preset table, such as the Blank 4x4 table. Add and delete rows and
add properties. To open the Edit Table dialog box, click Edit.
For more information on creating custom property tables, see “Property Table Components”.
If the Simulink Coder software is not installed, Summary (req Simulink Coder) does not appear
in this list. If you are using a report setup file that contains a summary property, the property name
appears in the report, but the property value does not.
Example
The following report displays information on the f14 model using the Simulation Parameters
preset table.
6-106
Simulink Property Table
Class
rptgen_sl.csl_prop_table
See Also
Model Loop, Signal Loop, System Loop
6-107
6 Components
Description
This component inserts a title for a Simulink sample time into the report.
Properties
• Table Options
Class
rptgen_sl.CSampleTime
See Also
Chapter/Subsection
6-108
Simulink Summary Table
Description
This component displays properties or parameters of selected Simulink models, systems, blocks, or
signals in a table.
Object type
Choose the object type to display in the generated report.
• Block (Default)
• Model
• System
• Signal
• Annotation
The selected object type affects the options available in the Property Columns pane.
Table title
Choose a title to appear in the generated report:
Property Columns
This pane displays object properties to include in the Summary Table in the generated report.
• To add a property:
1 Select the appropriate property level in the text box on the left.
2 In the text box on the right, select the property that you want to add and click Add.
• To delete a property, select the property name and click Delete.
The Parent property column displays only the name of the parent system. To display the full path of
the parent system, specify the property as parent with a lowercase p.
%<SplitDialogParameters> is a unique property for Simulink Summary Tables, where the object
type is Block. This property generates multiple summary tables, organized by block type. Each
Summary Table group contains the dialog box parameters for that block.
Some entries in the list of available properties (such as Depth) are “virtual” properties that you
cannot access using the get_param command. The properties used for property/value filtering in the
block and System Loop components must be retrievable by the get_param. Therefore, you cannot
configure your Summary Table to report on all blocks of Depth == 2.
6-109
6 Components
You can create multiple values for a property in a Simulink Summary Table. For example, to
report on blocks of type Inport, Outport and Constant:
1 Check the Search for Simulink property name/property value pairs box.
2 Make sure that you set Property Name to BlockType.
3 Type the following text into the Property Value field:
\<(Inport|Outport|Constant)\>
Transpose table: Changes the summary table rows into columns in the generated report, putting the
property names in the first column and the values in the other columns.
Object Rows
• Insert anchor for each row: Inserts an anchor for each row in the summary table.
• Report On:
• Automatic list from context: Reports on all blocks in the current context, as set by the
parent component.
• Custom - use block list: Reports on a list of specified blocks. Specify the full path of
each block.
Loop Options
• Sort blocks
6-110
Simulink Summary Table
• By layout (top to bottom): Sorts blocks by their location in the model layout, by
columns. The block appearing the furthest toward the left top corner of the model is the anchor
for the column. The column contains all other blocks that overlap the vertical area defined by
the left and right edges of the anchor block. The other columns use the same algorithm, using
as the anchor the next unreported block nearest the left top of the model.
• By traversal order: Sorts blocks by traversal order.
• By simulation order: Sorts blocks by execution order.
• %<VariableName>: Inserts the value of a variable from the MATLAB workspace. The %<>
notation can denote a string or cell array. For more information, see %<VariableName>
Notation on the Text component reference page.
• Search for Simulink property name/property value pairs: Reports on blocks with specified
property name/property value pairs.
Example
Specify the following options to generate a Summary Table in a report for on the model f14:
Name Blocks
f14 u, Actuator Model, Aircraft Dynamics Model, Angle of Attack, Controller,
Dryden Wind Gust Models, Gain, Gain1, Gain2, Gain5, More Info, More
Info1, Nz pilot calculation, Pilot, Pilot G force Scope, Stick Input, Sum,
Sum1, alpha (rad), Nz Pilot (g)
Aircraft Dynamics Model Elevator Deflection d (deg), Vertical Gust wGust (ft/sec), Rotary Gust
qGust (rad/sec), Gain3, Gain4, Gain5, Gain6, Sum1, Sum2, Transfer Fcn.1,
Transfer Fcn.2, Vertical Velocity w (ft/s), Pitch Rate q (rad/s)
Controller Stick Input (in), alpha (rad), q (rad/s), Alpha-sensor Low-pass Filter, Gain,
Gain2, Gain3, Pitch Rate Lead Filter, Proportional plus integral
compensator, Stick Prefilter, Sum, Sum1, Sum2, Elevator Command (deg)
Dryden Wind Gust Models Band-Limited White Noise, Q-gust model, W-gust model, Wg, Qg
More Info None
More Info1 None
Nz pilot calculation w, q, Constant, Derivative, Derivative1, Gain1, Gain2, Product, Sum1, Pilot
g force (g)
Class
rptgen_sl.csl_summ_table
6-111
6 Components
See Also
Block Loop, Model Loop, Signal Loop, System LoopSimulink Function System Loop
6-112
Simulink Test Suite Traceability Table
Description
This component inserts a table into the report. The table links a Simulink test suite to corresponding
requirements. This component reports on the currently open Simulink test suite. Place this
component inside a section, paragraph, or table component.
To use this component, your report setup must include Eval statements that open a Simulink test
suite or determine the test suite that is open.
Table Options
Specify information about the table this component inserts.
Table Columns
Specify the table columns that you want to include in the report. The Document name, Locations
within document, and Requirement keyword check boxes correspond to properties on the
Requirements Management Interface Link Editor dialog box.
• Description — Include the description of the requirement. The description helps you to identify
the requirement the table is linking to. Leave this box selected to improve the readability of your
table.
• Document name — Include the name of the document where the requirement is located.
• Locations within document — Include the identifier of a location in the document.
• Requirement keyword — Include the requirement keyword.
Class
RptgenRMI.TMReqTable
See Also
Data Dictionary Traceability Table, MATLAB Code Traceability Table, rmi
6-113
6 Components
Description
This component provides information about those workspace variables that the Simulink model uses,
in a loop generated by a Simulink Workspace Variable Loop component. Your report setup
must include Simulink Workspace Variable component as a child of a Simulink Workspace
Variable Loop component.
The report includes the name and value each variable. Optionally, you can include the following
information for each variable:
For variables that are Simulink data objects (for example, a Simulink.Parameter object), the
report includes the properties of the object. You can filter out properties to streamline the report.
Use a Simulink Workspace Variable Loop component as a parent for a Simulink Workspace
Variable component. In the Report Options dialog box, select Compile model to report on
compiled information.
Options
The following options specify additional information that the report can include about each variable:
6-114
Simulink Workspace Variable
• Show workspace: Report the source of each variable — MATLAB workspace, model workspace,
or data dictionary.
• Show blocks that use variable: Report the blocks that use each variable.
For variables whose values are Simulink data objects, you can filter the properties to include in the
report, using one of the following approaches:
• Use the Filter Properties area of the dialog box to specify a standard filter.
The standard filter options apply to all variables whose values are instances of the class or classes
that you specify. For example, you can use a standard filter to filter out the Description
property for all variables used by the model whose values use a Simulink.Parameter object.
• Select the Use custom property filter option and write MATLAB code for filtering.
Writing custom filtering code allows you to do kinds of filtering that the standard filter does not
perform. Some common examples of custom filters that you might want to create are filters that
filter out:
The Filter Properties area of the dialog box, where you specify a standard filter, has these fields.
• Class name (* for all classes): Specify the class of the variables for which you want to filter out
specific properties. You can specify one class at a time, or enter an asterisk (*) to specify all
classes. After you enter the class name, move the cursor outside of the edit box.
• Available Properties: If the class that you entered in Class name (* for all classes) is on the
MATLAB path, then this list displays the properties of that class.
• Filtered Properties: Displays the properties to filter out. Use the right-arrow button to add to the
Filtered Properties list the properties that you selected in the Available Properties list.
• If the class that you enter is not on the MATLAB path, then a Comma-separated list of
properties to be filtered edit box appears. Enter the names of properties to use for filtering.
• Convert to Custom: Generate custom MATLAB code that implements your Filter Properties
standard filter settings.
Note Selecting the Convert to Custom button overwrites any existing MATLAB custom filtering
code for this component.
To create and apply custom filtering MATLAB code, select the Use custom property filter check
box. Selecting this check box opens an edit box where you define a MATLAB function for filtering
properties. The edit box includes a sample function (commented out) that you can use as a starting
point for your filtering function. Use the isFiltered variable for the output of your function. For
example:
• To filter out the Owner and testProp properties, in the edit box enter:
6-115
6 Components
If you clear the Use custom property filter check box, Simulink Report Generator saves your
custom MATLAB filtering code, but does not use that code to filter properties.
Class
rptgen_sl.csl_ws_variable
See Also
Simulink Workspace Variable Loop, Bus, Simulink Functions and Variables
6-116
Simulink Workspace Variable Loop
Description
This component generates a model variable loop used by the Simulink Workspace Variable
component to report on those workspace variables that the Simulink model uses.
You can limit the variables included in the loop to those that match property name and value pairs
that you specify. If you want to report on model variables, your report setup file must include this
component as a child of a Model Loop component and must include a Simulink Workspace
Variable component as its child. Also, in the Report Options dialog box, select Compile model to
report on compiled information. For example:
Loop Options
• Sort
Section Options
• Create section for each object in loop: Creates a separate section in the output for each
variable.
6-117
6 Components
• If you specify to create a section for each variable, you can select the Display the object type
in the section title to insert a variable name in each section title.
• Create link anchor for each object in loop: Create a link target for each workspace variable in
the loop so that other parts of the report can link to it.
Class
rptgen_sl.csl_ws_var_loop
See Also
Simulink Workspace Variable, Bus, Simulink Functions and Variables
6-118
State Loop
State Loop
Run child components for all states in current context
Description
This component runs its children for all states in its context. The parent component of this component
determines the context.
For conditional processing based on states, you can use the RptgenSF.getReportedState
function. For more information, see “Loop Context Functions” on page 4-90.
State Types
• Include “and” and “or” states: Includes AND and OR states in the loop.
• Include “box” states: Includes “box” states in the loop.
• Include functions: Includes “function” states in the loop.
• Include truth tables: Includes truth tables in the loop.
• Include MATLAB functions: Includes MATLAB functions in the loop.
Loop Options
• Report depth: Specifies the level on which to loop.
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target for each state in the loop so
that other parts of the report can link to it. For example, the image created by a Stateflow
Snapshot component can link to the chart information only if you select this check box.
6-119
6 Components
Class
rptgen_sf.csf_state_loop
See Also
Chart Loop, Machine Loop, Model Loop, System Loop, Simulink Function System Loop
6-120
State Transition Matrix
Description
This component inserts the contents of state transition matrices into a report. A state transition
matrix is an alternative view of a state transition table. In the state transition matrix, you can easily
see how the state transition table reacts to each condition and event.
Options
• Title
• No title (default): Report uses no title for the state transition matrix.
• Use Stateflow name: For the title in the report, uses the names of the State Transition
Table blocks from which the state transition matrices are generated.
• Custom: In the text field, specify a custom name for the state transition matrix.
• Display condition actions on matrix: Include the state transition matrix condition actions. A
condition action is an action that executes as soon as a condition evaluates to true. The condition
action is part of a transition label.
Class
rptgen_sf_csf_statetransitionmatrix
See Also
State Transition Table
6-121
6 Components
Description
This component inserts the state transition tables into a report. A state transition table is an
alternative way of expressing sequential modal logic. Instead of drawing states and transitions
graphically in a Stateflow® chart, you express the modal logic in tabular format.
Options
• Title
• No title (default): Report uses no title for the state transition table.
• Use Stateflow name: Uses the name of the State Transition Table block as the title.
• Custom: In the text field, specify a custom name for the state transition table.
Class
rptgen_sf_csf_statetransitiontable
See Also
State Transition Matrix
6-122
Stateflow Automatic Table
Description
This component inserts a table that contains the properties of the current Stateflow object. Parents of
this component can be:
• Machine Loop
• State Loop
• Chart Loop
• Graphics Object Loop
Display Options
• Table title: Specifies a title for the table in the generated report.
• Object name
• Object name with Stateflow path
• Object name with Simulink and Stateflow path
• Header row: Selects a header row for the table in the generated report.
Class
rptgen_sf.csf_auto_table
See Also
Chart Loop, Graphics Object Loop, Machine Loop, State Loop
6-123
6 Components
Stateflow Count
Count number of Stateflow objects in current context
Description
This component counts the number of Stateflow objects in the current context.
Properties
• Search depth: Specifies the search depth for the count.
• Immediate children only (default): Searches only children one level under the Stateflow
object.
• All descendants: Searches all children of the Stateflow object.
• Sort results: Specifies the sort method for the count results.
Class
rptgen_sf.csf_count
See Also
State Loop
6-124
Stateflow Dialog Snapshot
Description
This component reports on the current reported Stateflow dialog box object, depending on its
context. If this component is the child of a State Loop, for example, the report includes information
about the dialog box of the current State. Display the current settings associated with an object or
document the appearance of your custom mask dialog boxes.
Format
• Image file format: Specifies the format for the snapshot image file. The Automatic format uses
BMP format for PDF files and PNG for other formats.
• Show all tabs: Automatically generates images for all the tabs for the dialog box. If you clear this
check box, the Simulink Report Generator software creates an image of only the first tab.
Display Options
• Scaling: Controls size of the image, as displayed in a browser. Making an image larger using this
option does not affect the storage size of the image, but the quality of the displayed image may
decrease as you increase or decrease the size of the displayed image.
Generally, to achieve the best and most predictable display results, use the default setting of Use
image size.
• Use image size: Causes the image to appear the same size in the report as on screen
(default).
• Fixed size: Specifies the number and type of units.
• Zoom: Specifies the percentage, maximum size, and units of measure.
• Size: Specifies the size of the snapshot in the form w h (width, height). This field is active only if
you choose Fixed size in the Scaling selection list.
• Max size: Specifies the maximum size of the snapshot in the form w h (width, height). This field is
active only if you choose Zoom in the Scaling selection list.
• Units: Specifies the units for the size of the snapshot. This field is active only if you choose Zoom
or Fixed size in the Image size list box.
• Alignment: Aligns your snapshot. Only reports in PDF or RTF format support this property.
• Auto
• Right
• Center
• Left
• Title: Specifies text to appear above the snapshot.
• Caption: Specifies text to appear under the snapshot.
6-125
6 Components
Class
rptgen_sl.Cdialog boxesnapshot
See Also
State Loop
6-126
Stateflow Filter
Stateflow Filter
Run child components only if current object type matches specified object type
Description
This component runs its children only if the current object type, as set by its parent Stateflow
Hierarchy Loop, matches the selected object type.
Properties
• Object type: Specifies the Stateflow object type to include in the report.
• Run only if Stateflow object has at least the following number of Stateflow children:
Specifies a minimum number of children that a Stateflow object must have to include in the
report.
• Automatically insert linking anchor: Inserts a linking anchor before the reported object. If an
anchor for this object exists, this option does not create a second anchor.
Class
rptgen_sf.csf_obj_filter
See Also
Stateflow Hierarchy Loop
6-127
6 Components
Stateflow Hierarchy
Provide visual representation of the hierarchy of a Stateflow object
Description
This component inserts a tree that shows the hierarchy of a given Stateflow object.
Tree Options
• Construct tree from: Specifies the object to use for the tree representation.
• Current object
• Root of current object: Starts reporting from the top of the hierarchy.
• Emphasize current object in tree: Highlights the current object in the tree representation.
• Show number of parents: Specifies the number of parents to include in the tree representation.
• Show siblings: Displays siblings in the tree representation.
• Show children to depth: Specifies the depth of children to display for each object in the tree
representation.
Children
• Show junctions: Specifies the level of junction detail to display in the generated report.
• All
• Non-redundant
• None
• Show transitions: Specifies the level of transition detail to display in the generated report.
• All
• Labeled or non-redundant
• Non-redundant
• Labeled
• None
• Show ports: Specifies the level of port detail to display in the generated report.
• All
• Labeled or non-redundant
• Non-redundant
• Labeled
• None
• Skip autogenerated charts under truth tables: Excludes autogenerated charts under truth
tables.
6-128
Stateflow Hierarchy
List Formatting
• List style:
• Bulleted list
• Numbered list: Allows you to specify numbering options in the Numbering style section.
• Numbering style: Allows you to specify a numbering style. This setting supports only the
RTF/DOC report format.
• 1,2,3,4...
• a,b,c,d...
• A,B,C,D...
• i,ii,iii,iv...
• I,II,III,IV...
To show the parent number in each list entry, select Show parent number in nested
list (1.1.a). To show only the current number or letter, select Show only current
list value (a).
Class
rptgen_sf.csf_hier
See Also
Stateflow Hierarchy Loop
6-129
6 Components
Description
This component runs its child components on the Stateflow object hierarchy.
Loop Options
• Minimum legible font size: Specifies the minimum font size to use in the report. The default
font size, 8, is the smallest recommended font size.
• Skip autogenerated charts under truth tables; Excludes autogenerated charts under truth
tables in the report.
• Search Stateflow: Reports on Stateflow charts with specified property name/property value
pairs.
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Create link anchor for each object in loop: Create a link target on each object in the loop so
that other parts of the report can link to it.
Class
rptgen_sf.csf_hier_loop
See Also
Stateflow Hierarchy
6-130
Stateflow Linking Anchor
Description
This component designates a location to which other links point. The linking anchor is set to the
current object, as defined by the parent component.
This component must have the Chart Loop, State Loop, Machine Loop, or Stateflow Filter
component as its parent.
Properties
Insert text: Specifies text to appear after the linking anchor.
Class
rptgen_sf.csf_obj_anchor
See Also
Chart Loop, Machine Loop, State Loop, Stateflow Filter,
6-131
6 Components
Stateflow Name
Insert into report name of Stateflow object specified by parent component
Description
This component inserts the name of the Stateflow object, as defined by its parent component, into the
report. This component must have the State Loop, Chart Loop, or Stateflow Filter
component as its parent.
Using this component as the first child component of a Chapter/Subsection component allows the
current Stateflow object name to be the chapter or section title.
Properties
• Display name as: Displays the Stateflow object name in the report.
• Object name
• Object name with Stateflow path
• Object name with Simulink and Stateflow path
Class
rptgen_sf.csf_obj_name
See Also
Chapter/Subsection, Chart Loop, State Loop, Stateflow Filter
6-132
Stateflow Property
Stateflow Property
Insert into report table, text, or paragraph with information on selected Stateflow object property
Description
This component inserts a table, text, or paragraph that contains details of the selected Stateflow
object property.
Property to Display
Property name: Specifies the Stateflow property name to display. If the Stateflow object is an
annotation, the Display options are ignored. Annotation content is reported as plain text for web
(HTML), Acrobat (PDF), and Word Document (rtf) output types or as formatted text for other output
types.
Display Options
• Title: Specifies a title to display in the generated report.
Setting a size limit of 0 always displays the variable in long form, regardless of its size.
• Display as: Specifies a display style from the menu.
Class
rptgen_sf.csf_property
6-133
6 Components
See Also
Paragraph, Table, Text, Stateflow Name
6-134
Stateflow Property Table
Description
This component inserts a property-value table for a Stateflow object into the report. Use the
Stateflow Filter component as the parent of this component.
For more information on working with Property Table components, see “Property Table Components”.
Table
Select a preset table, which is already formatted and set up, in the preset table list in the upper-left
corner of the attributes page.
• Preset table: Specifies a type of table to display the object property table.
• Default
• Machine
• Chart
• State
• TruthTable
• EMFunction
• SLFunction
• Data
• Event
• Junction
• Port
• Transition
• Target
• Blank 4X4
• For the property name and property value to appear in adjacent horizontal cells, select the
Split property/value cells check box. In this case, the table is in split mode, there is only one
property name/property value pair per cell. If there is more than one name/property pair in a
cell, only the first pair appears in the report. The report ignores all subsequent pairs.
• For the property name and property value to appear together in one cell, clear the Split
property/value cells check box. This setting is nonsplit mode. Nonsplit mode supports more
than one property name/property value pair and text.
• Before switching from nonsplit mode to split mode, make sure that there is only one property
name/property value pair per table cell. When there is more than one property name/property
6-135
6 Components
value pair or any text in a given cell, only the first property name/property value pair appears
in the report. The report omits subsequent pairs and text.
• Display outer border: Displays the outer border of the table in the generated report.
• Table Cells: Specifies table properties to modify. The selection in this pane affects the available
fields in the Cell Properties pane.
Cell Properties
The options in the Title Properties pane depend on the object selected in the Table Cells pane. If
you select %<Name>, only Contents and Show appear. If you select any other object in the Table
Cells pane, Lower border and Right border appear.
• Contents: Modifies the contents of the table cell selected in the Table Cells pane.
• Alignment: Justifies the contents of the selected table cell in the Table Cells pane.
• Left
• Center
• Right
• Double justified
• Show As: Specifies the format for the contents of the table cell.
• Value
• Property Value
• PROPERTY Value
• Property: Value
• PROPERTY: Value
• Property - Value
• PROPERTY - Value
• Lower border: Displays the lower border of the table in the generated report.
• Right border: Displays the right border of the table in the generated report.
You can edit a preset table, such as the Blank 4x4 table, to create a custom table. Add and delete
rows and add properties. To open the Edit Table dialog box, click Edit.
For details about creating custom property tables, see “Property Table Components”.
Class
rptgen_sf.csf_prop_table
6-136
Stateflow Property Table
See Also
Stateflow Filter
6-137
6 Components
Stateflow Snapshot
Insert into report snapshot of Stateflow object
Description
This component inserts a snapshot (screen capture) of a Stateflow object, defined by the Stateflow
Filter parent component, into a report.
This component executes only if the selected object in the Stateflow Filter component is a
graphical object, such as Chart, State, Transition, or Frame.
For HTML and Direct PDF (from template) output, the state charts in the resulting image can
link to associated report information. To enable this linking, on the Chart Loop component that this
component is a descendant of, select the Create link anchor for each object in loop check box.
For Direct PDF (from template) output, you also need to set the output format to Automatic
SF format or Scalable Vector Graphics.
Snapshot
• Format: Specifies the image file format. Select Automatic SF Format (default) to choose the
format best suited for the specified report output format automatically. Otherwise, choose an
image format that your output viewer can read.
• Automatic SF Format — Select this option, or Scalable Vector Graphics, with Direct
PDF (from template) report output format if you are linking the snapshot to related report
content.
• Bitmap
• JPEG high quality image
• JPEG low quality image
• JPEG medium quality image
• PNG 24–bit image
• Scalable Vector Graphics
• Paper orientation:
• Portrait
• Landscape
• Rotated
• Largest dimension vertical: Positions the image so that its largest dimension is vertical.
• Use Chart PaperOrientation setting: Uses the paper orientation setting for the chart.
Use the Simulink PaperOrientation parameter to specify the orientation.
• Full page image (PDF only): In PDF reports, scales images to fit the full page, minimizes
page margins, and maximizes the size of the image by using either a portrait or landscape
orientation.
For more information about paper orientation, see the orient command in the MATLAB
documentation.
6-138
Stateflow Snapshot
• Image sizing:
Properties
• Include callouts to describe visible objects: Displays descriptive callouts for visible objects.
• Insert anchors for transitions and junctions: Inserts anchors for transitions and junctions into
the report.
• None
• Redundant children only
• All
• Run only if Stateflow object has at least the following number of children: Specifies the
minimum number of children that the current Stateflow object must have to include in the report.
This option is inactive unless the selected object in the parent Stateflow Filter component is
a graphical object.
Tip This option allows you to exclude certain images to decrease the size of the report for large
models.
Display Options
• Scaling:
• Use image size: Uses the image size that you specify in the snapshot option.
• Zoom and Fixed size: Allows you to specify the size of the image.
• Size: Specifies a size in inches for your image. The default is 7-by-9.
• Max size: Specifies the maximum size of the snapshot in the format w h (width, height). This field
is active only if you choose Zoom from the Scaling selection list.
• Units: Specifies the units for the size of the snapshot. This field is active only if you choose Zoom
or Fixed sizein the Image size list box.
• Alignment: Only reports in PDF or RTF format support this property.
• Auto
6-139
6 Components
• Right
• Center
• Left
• Image title:
• None(Default).
• Object name: Uses the object name as the title.
• Full Stateflow name: Specifies the Stateflow path and the name of the object.
• Full Simulink + Stateflow name: Specifies the Simulink path and name of the object.
• Custom: Enter a different title.
• Caption: Specifies a caption for your image.
• None(Default).
• Custom: Specifies a custom caption.
• Description: Sets the caption to the value of the object Description property.
Class
rptgen_sf.csf_obj_snap
Class
rptgen_sf.csf_prop_table
See Also
Stateflow Filter
6-140
Stateflow Summary Table
Description
This component displays a table of properties or parameters of specified Stateflow objects. It can
have the following parents:
Properties
• Object type: Specifies the object type to display in the generated report. This value affects the
options available in the Property Columns pane.
• Table title: Specifies a title for the Summary Table in the generated report.
Property Columns
• Property columns: Displays the object properties to include in the Summary Table in the
generated report.
• To add a property:
Some entries in the list of available properties (such as Depth) are “virtual” properties that you
cannot access using the get_param command. The properties used for property/value filtering in
the block and System Loop components must be retrievable by the get_param. Therefore, you
cannot configure your Summary Table to report on all blocks of Depth == 2.
• Remove empty columns: Removes empty columns from the Summary Table in the generated
report.
• Transpose table: Changes the summary table rows into columns in the generated report, putting
the property names in the first column and the values in the other columns.
Object Rows
Insert anchor for each row: Inserts an anchor for each row in the summary table.
6-141
6 Components
Report On
• Automatic list from context: Reports on all blocks in the current context, as set by the parent
component.
• Custom - use block list: Reports on a specified list of blocks. Specify the full path of each block.
Loop Options
Choose block sorting options and reporting options in this pane.
• Sort blocks: Specifies how to sort blocks (applied to each level in a model):
• By layout (top to bottom): Sorts blocks by their location in the model layout, by
columns. The block appearing the furthest toward the left top corner of the model is the anchor
for the column. The column contains all other blocks that overlap the vertical area defined by
the left and right edges of the anchor block. The other columns use the same algorithm, using
as the anchor the next unreported block nearest the left top of the model.
• By traversal order: Sorts blocks by traversal order.
• By simulation order: Sorts blocks by execution order.
• Search for Simulink property name/property value pairs: Reports on blocks with specified
property name/property value pairs.
• Search Stateflow: Reports on Stateflow charts with specified property name/property value
pairs.
6-142
Stateflow Summary Table
Class
rptgen_sf.csf_summ_table
See Also
Block Loop, Chart Loop, Model Loop, Object Loop, Signal Loop, State Loop, Stateflow
Hierarchy Loop, System Loop
6-143
6 Components
System Filter
Run child components if current system meets specified conditions
Description
This component runs its child components if the current system meets the conditions that you specify
with this component.
Properties
• Report only if system has at least N blocks: Specifies the minimum number of blocks that the
system must include for any of the child components to run. If you enter 0, child components run
regardless of the number of blocks in the system.
• Report only if system has at least N subsystems: Specifies the minimum number of
subsystems that the system must include for the child components to run. If you enter 0, child
components run regardless of the number of subsystems in the system.
• Report only if system mask type is: Specifies which masks to include in the generated report.
Class
rptgen_sf.csf_obj_filter
See Also
System Loop
6-144
System Hierarchy
System Hierarchy
Create nested list that shows hierarchy of specified system
Description
This component creates a nested list that shows the hierarchy of a specified system. The list can
display all systems in a model, or the parents and children of the current system.
Starting System
• Build list from: Specifies the system or model from which to build the list.
• Current system
• Current model
• Emphasize current system: Highlights the current system or model in the generated report.
Display Systems
• Show number of parents: Specifies the number of parents to list.
• Display peers of current system: Shows the peers of the current system in the generated
report.
• Show children to depth: Specifies the depth of children to list.
List Formatting
• List style:
• Bulleted list
• Numbered list: Allows you to select numbering options in the Numbering style section.
• Numbering style: Allows you to select a numbering style in the selection list, by setting List
style to Numbered list. Only the RTF/DOC report format supports this option.
• 1,2,3,4,...
• a,b,c,d,...
• A,B,C,D,...
• i,ii,iii,iv,...
• I,II,III,IV,...
Class
rptgen_sl.csl_sys_list
6-145
6 Components
See Also
Model Loop, System Loop
6-146
System Loop
System Loop
Specify systems and subsystems on which to loop, as defined by parent component
Description
This component runs its child components for each system defined by the parent component. For
example, to include systems and subsystems within a given model in the report, you can include this
component as the child of a Model Loop component.
For conditional processing systems, you can use the RptgenSL.getReportedSystem function. For
more information, see “Loop Context Functions” on page 4-90.
Report On
• Loop on Systems:
• Select systems automatically: Reports on all systems in the current context as set by
the parent component.
If this component does not have any of these components as its parent, selecting this option
reports on all systems in all models.
• Custom - use system list: Reports on a list of specified systems. Specify the full path of
each system.
• %<VariableName>: Inserts the value of a variable from the MATLAB workspace. The %<>
notation can denote a string or cell array. For more information, see %<VariableName>
Notation on the Text component reference page.
• Include subsystems in Simulink functions: Specifies whether to include subsystems in
Simulink functions. By default, this option is enabled.
Loop Options
• Sort Systems: Specifies how to sort systems.
6-147
6 Components
To find property names for Subsystem blocks, see the Programmatic Use sections for the
parameters in Subsystem, Atomic Subsystem, CodeReuse Subsystem or select a Subsystem block
in the model and enter this code at the MATLAB command line:
get(gcbh)
Section Options
• Create section for each object in loop: Inserts a section in the generated report for each object
found in the loop.
• Display the object type in the section title: Inserts the object type automatically into the
section title in the generated report.
• Number sections by system hierarchy: Hierarchically numbers sections in the generated
report. Requires that Sort Systems be set to By traversal order.
• Create link anchor for each object in loop: Create a link target for each system in the loop so
that other parts of the report can link to it. For example, the image created by a System
Snapshot component can link to the subsystem section only if you select this check box.
Examples
For an example of how to use this component with a Model Loop as its parent, see Model Loop.
Class
rptgen_sl.csl_sys_loop
See Also
Block Loop, Model Loop, Signal Loop
6-148
System Snapshot
System Snapshot
Insert snapshot of the current system into report
Description
This component inserts a snapshot (screen capture) of the current system into a report. A System
Snapshot must be a child or descendant of a System Loop component.
For HTML and Direct PDF (from template) output, the blocks and subsystems in the resulting
image can link to associated report information. For example, a block in the report can link to a block
property table. A subsystem can link to the subsystem block diagram or to the block properties.
Note For PDF reports in which you want to include hyperlinks in system snapshots, use Direct PDF
(from template) file format. If you use Acrobat (PDF) format, snapshots do not include
hyperlinks.
To enable this linking, select the Create link anchor for each object in loop check box on the
appropriate loop component:
• For blocks and masked subsystems in this system, select the check box on the Block Loop
component that reports on the system’s blocks.
• To provide links to the sections that report on the unmasked subsystems of this system, select the
check box on the System Loop component.
For Direct PDF (from template) output, you also need to set the output format to Automatic
SL format or Scalable Vector Graphics.
Snapshot Options
• Format: Specifies the image file format. Select Automatic SL Format (the default) to choose
the format best suited for the specified report output format automatically. Otherwise, choose an
image format that your output viewer can read.
• Automatic SL Format — Select this option. or Scalable Vector Graphics, with Direct
PDF (from template) report output format if you are linking the snapshot to related report
content.
• Bitmap
• JPEG high quality image
• JPEG low quality image
• JPEG medium quality image
• PNG 24–bit image
• Scalable Vector Graphics
• Orientation:
• Largest dimension vertical: Positions the image so that its largest dimension is vertical.
6-149
6 Components
• Landscape
• Portrait
• Use system orientation: Uses the paper orientation setting for the system. Use the
Simulink PaperOrientation parameter to specify the orientation.
• Full page image (PDF only): In PDF reports, scales images to fit the full page, minimizes
page margins, and maximizes the size of the image by using either a portrait or landscape
orientation.
• Scaling: Controls the size of the image in the image file.
Note Selecting Use printframe paper settings deactivates the Custom and Zoom options
and automatically scales the image to the print frame size.
Properties Options
• Include callouts to describe visible objects: Displays descriptive callouts for visible objects
• Use printframe: Prints a frame around the image. You can use the default frame,
rptdefaultframe.fig, or use the Frame Editor to build a custom frame. For more information,
see the frameedit function in Simulink documentation.
The default frame is five inches wide and four inches high. It includes the name of the system and
the model folder. This frame is optimized for use with a portrait paper orientation. The Flight
Control Model in the f14 Simulink model appears here with the default Simulink Report
Generator frame option.
6-150
System Snapshot
Display Options
To access the display options, click the Advanced button.
• Scaling: Controls size of the image, as displayed in a browser. Making an image larger using this
option does not affect the storage size of the image, but the quality of the displayed image may
decrease as you increase or decrease the size of the displayed image.
Generally, to achieve the best and most predictable display results, use the default setting of Use
image size.
• Use image size: Causes the image to appear the same size in the report as on screen
(default).
• Fixed size: Specifies the number and type of units.
• Zoom: Specifies the percentage, maximum size, and units of measure.
• Size: Specifies the size of the snapshot in a browser, using the format w h (width, height). This
field is active only if you choose Fixed size in the Scaling selection list.
• Max size: Specifies the maximum size of the snapshot in a browser, using the format w h (width,
height). This field is active only if you choose Zoom in the Scaling selection list.
• Units: Specifies the units for the size of the snapshot in a browser. This field is active only if you
choose Fixed size in the Image size list box.
6-151
6 Components
• Auto
• Right
• Left
• Center
• Image title:
• None (Default)
• System name: Uses the system name as the image name.
• Full system name: Uses the system name, with path information, as the image name.
• Custom: Specifies a custom title.
• Caption:
• None (Default)
• Description (use system description)
• Custom: Specifies a custom caption.
Class
rptgen_sl.csl_sys_snap
See Also
System Loop, Block Loop
6-152
Test Sequence
Test Sequence
Capture Test Sequence block information
Description
This component captures information about Simulink Test™ Test Sequence blocks. The report
includes the test sequence using the tabular series of steps from the Test Sequence block.
• Use Test Sequence name (default): Use the name of the Test Sequence block as the section
title.
• Custom: Specify a custom section title in the text box.
Step Content
Select the step content to include in the report.
• Include description, action, and transition table (default): Include all the step data in the
report, i.e., step descriptions, action statements, transition table, and when condition.
• Include description only: Include only the description of each step in the report.
• Include action and transition table only: Include the action statements, transition table, and
when condition in the report.
• None: Do not include the description, action, or transition table in the report.
• Show requirements: Include links to requirements that are attached to steps in the Test
Sequence block.
Class
rptgen_stm.cstm_testseq
6-153
6 Components
To Workspace Plot
Capture plot figure created in the MATLAB workspace
Description
This component captures a plot figure created in the MATLAB workspace, and then inserts one or
both of the following into the report:
Print Options
• Image file format: Specifies the image file format (for example, JPEG or TIFF) from this list.
Select Automatic HG Format (the default) to choose the format best suited for the specified
report output format automatically. Otherwise, choose an image format that your output viewer
can read. Other options are:
• Automatic HG Format (Uses the file format selected in the Preferences dialog box)
• Bitmap (16m-color)
• Bitmap (256-color)
• Black and white encapsulated PostScript
• Black and white encapsulated PostScript (TIFF)
• Black and white encapsulated PostScript2
• Black and white encapsulated PostScript2 (TIFF)
• Black and white PostScript
• Black and white PostScript2
• Color encapsulated PostScript
• Color encapsulated PostScript (TIFF)
• Color encapsulated PostScript2
• Color encapsulated PostScript2 (TIFF)
• Color PostScript
• Color PostScript2
• JPEG high quality image
• JPEG medium quality image
• JPEG low quality image
• PNG 24-bit image
• TIFF - compressed
• TIFF - uncompressed
• Windows metafile
• Paper orientation:
6-154
To Workspace Plot
• Landscape
• Portrait
• Rotated
• Use figure orientation: Uses the orientation for the figure, which you set with the
orient command.
• Full page image (PDF only): In PDF reports, scales images to fit the full page, minimizes
page margins, and maximizes the size of the image by using either a portrait or landscape
orientation.
For more information about paper orientation, see the orient command in the MATLAB
documentation.
• Image size:
• Automatic: Automatically changes dark axes colors to light axes colors. If the axes color is a
light color, it is unchanged.
• Invert: Changes dark axes colors to light axes colors, and light axes colors to dark axes
colors.
• Don't invert: Retains image colors displayed on screen in the printed report.
• Use figure's InvertHardcopy setting: Uses the InvertHardcopy property set in the
Handle Graphics image.
• Make figure background transparent: Makes the image background transparent.
Display Options
• Scaling: Controls size of the image, as displayed in a browser. Making an image larger using this
option does not affect the storage size of the image, but the quality of the displayed image may
decrease as you increase or decrease the size of the displayed image.
Generally, to achieve the best and most predictable display results, use the default setting of Use
image size.
• Use image size: Causes the image to appear the same size in the report as on screen
(default).
• Fixed size: Specifies the number and type of units.
6-155
6 Components
• Auto
• Right
• Left
• Center
• Title: Specifies text to appear above the snapshot.
• Caption: Specifies text to appear under the snapshot.
Class
rptgen_sl.csl_blk_toworkspace
See Also
Figure Loop
6-156
Truth Table
Truth Table
Report on truth tables in Simulink and Stateflow models
Description
The Truth Table component reports on truth tables in Simulink and Stateflow models. It displays both
the condition table and the action table. The parent component of the Truth Table determines its
behavior.
Title
Title: Specifies a title for the truth table.
• No title
• Use Stateflow name
• Custom
Condition Table
Specify display parameters for the condition table.
Action Table
• Show header: Displays the column headers in the table.
• Show number: Displays the condition number column in the table.
• Show condition: Displays the condition column in the table.
• Show description: Displays the description column in the table. If you do not select this option,
no action table appears in the report.
6-157
6 Components
Class
rptgen_sf.csf_truthtable
See Also
Block Loop, Model Loop, Signal Loop, System Loop
6-158
7
Classes
7 Classes
slreportgen.webview.EmbeddedWebViewDocumen
t class
Package: slreportgen.webview
Create a report generator that generates an HTML report containing an interlinked document and
associated web view
Description
Creates a report generator that generates an HTML report containing a document and a web view of
one or more Simulink models, with two-way hyperlinks between the document and the web view.
This class provides the following facilities for generating embedded web view reports:
• A report generator based on an slreportgen.report.Report object. You can use DOM and
Report APIs to fill the document content.
• An HTML template with three panels for a table of contents (TOC), document content, and a web
view, respectively
• Template holes to be filled with the document content and a web view, respectively. The hole for
the web view is named slwebview and is located in the right panel of the report. The hole for
document content is named Content and is located in the center panel of the report.
• Methods for filling the document and web view holes.
• Methods for creating two-way hyperlinks between the document content and embedded
webview(s)
• JavaScript that generates a TOC from document headings when the report opens in a browser
• Model export options that allow you to specify the models and subsystems to be embedded as web
views in the generated report
• Methods for retrieving elements (diagrams, blocks, charts, etc.) from models to be embedded as
web views in the report
Construction
rptgen = slreportgen.webview.Embedded WebViewDocument(rptname,model) creates a
report generator that generates a report having the specified file name and containing a web view of
the specified model. Use the generator’s fill method to generate the web view and embed the web
view in the document. Use the generator’s close method to output the document as a zip file or
folder containing the HTML document.
rptgen = slreportgen.webview.EmbeddedWebViewDocument(rptname,model1,
model2,...modeln) creates a report generator that includes two or more models in the web view
that it creates. This constructor assigns an array of default
slreportgen.webview.ExportOptions objects to the generator’s ExportOptions property, one
for each of the models to be included in the generated document’s web view. You can use the objects
to specify custom export options for each of the models to be included in the web view exported to
the generated document.
7-2
slreportgen.webview.EmbeddedWebViewDocument class
import slreportgen.webview.*
rptgen = EmbeddedWebViewDocument('myDoc');
rptgen.ExportOptions.Diagrams = 'myModel';
Input Arguments
rptname — Name of output report file and/or folder
character vector
Name of the zip file and/or folder containing the report generated by this generator. Use this
generator’s PackageType property to specify whether to package the generated report as a file or a
folder or both. If you specify an extension, the extension must be .htmx. If you do not specify an
extension, the report generator appends .htmx.
Name of model, specified as a character vector, to be embedded in the generated report as a web
view.
Output Arguments
rptgen — Embedded web view report generator
slreportgen.webview.EmbeddedWebViewDocument
Properties
CurrentHoldID — Identifier of current hole in document
character vector
Identifier of current hole in document, stored as a character vector. This is a read-only property.
7-3
7 Classes
Whether to overwrite an existing report with the same name. True overwrites the existing report.
False generates the report under a new name.
Status of the report being generated, either 'unopened' or 'opened'. This is a read-only property.
Packaging to use for output document, specified as one of these character vectors:
Path to the HTML template to use to generate this report, specified as a character vector. The
template has an .htmtx extension. This property points by default to a default template. To use a
custom template, set this property to the path of the custom template.
Text to display in the title bar of the HTML browser used to display the generated report. The default
text is “Simulink Web View - Created by Simulink Report Generator."
Generates a warning at the command line if the link target that you specify does not exist or if you
specify a link from a model element that already has a link. Validation checking increases the time
required to generate a report. For this reason, consider using link validation checking only when
debugging your report.
Methods
Method Purpose
createDiagramTwoWayLink Creates a two-way link between a location in the
document in the center panel and a diagram in
the web view in the right panel
7-4
slreportgen.webview.EmbeddedWebViewDocument class
Method Purpose
createElementTwoWayLink Creates a two-way link between a document
panel location and a diagram element in the web
view
createDiagramLink Creates a link from the document panel to a
diagram in the model web view
createElementLink Creates a link from the document panel to an
element in the model web view
fill Invoke the embedded web view report
generator’s hole filling methods to fill the holes in
its template.
fillslwebview Fills template’s slwebview hole with a web view
getExportModels Names of models to be included in the web view
getExportDiagrams Paths and handles of block diagrams to be
included in the web view
getExportSimulinkSubSystems Paths and handles of subsystem blocks to be
included in this web view
getExportStateflowCharts Paths and handles of Stateflow charts to be
included in this web view
getExportStateflowDiagrams Array of Stateflow diagram paths
getReportObject Returns the report object for the embedded web
view report
Compatibility Considerations
Items in table of contents are not numbered
Behavior changed in R2019b
Starting in R2019b, items in the table of contents in an embedded web view report are not numbered.
To generate numbered items in a table of contents:
1 Copy the default template for an embedded web view report to the current folder.
copyfile(fullfile(matlabroot,'/toolbox/slreportgen/webview/resources/templates/embedded_webview.htmtx'))
2 Unzip the template into the subfolder myTemplate.
unzipTemplate('embedded_webview.htmtx','myTemplate');
3 In myTemplate, navigate to the stylesheets subfolder. Open the root.css file and remove
this line from the ol.toc style:
list-style-type: none;
4 Save the root.css file.
5 Navigate to the folder that contains the original zipped template file. Package the unzipped
template files into a zipped template file.
zipTemplate('Newtemplate.htmtx','myTemplate');
6 Set the TemplatePath property of the embedded web view report generator object to the path
and name of the new template file. For example, suppose that MyEmbeddedWebView is a subclass
7-5
7 Classes
rpt = MyEmbeddedWebView(rptName,model);
rpt.TemplatePath = 'NewTemplate.htmtx';
See Also
slreportgen.webview.ExportOptions
Topics
“Create an Embedded Web View Report Generator” on page 5-24
“Embedded Web View Reports” on page 5-20
Introduced in R2017a
7-6
slreportgen.report.Bus class
slreportgen.report.Bus class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Use an object of the slreportgen.report.Bus class to report on buses that are selected or
created by Simulink blocks.
A bus reporter finds buses to report by searching a model, subsystem, block, or signal for blocks that
select signals from a bus or combine signals to create a bus. For a model or subsystem, the Bus
reporter reports all of the buses selected or created in the model or subsystem. For a block, the
reporter reports the bus that is selected or created by the block. For a signal, the reporter reports all
of the buses selected or created by the blocks that are connected to the port specified by the signal.
Use the Object property to specify the model, subsystem, block, or signal for which to report buses.
Use the reporter properties to customize the content and appearance of the generated report. For
example, use the ReportedBlockType property to specify which types of blocks to use when
searching for buses.
Note To use an slreportgen.report.Bus reporter in a report, you must create the report using
the slreportgen.report.Report class or subclass.
Class Attributes
HandleCompatible true
Creation
Description
7-7
7 Classes
Properties
Object — Model, block, or signal to search for buses
[] (default) | string scalar | character vector | handle | slreportgen.finder.DiagramResult
object | slreportgen.finder.BlockResult object | slreportgen.finder.SignalResult
object
Model, block, or signal to search for buses, specified as one of the following values:
Title for each reported bus, specified as a string scalar, character vector, DOM object, or function
handle. The contents of this property are reported with each bus included by the reporter. If this
property is empty, no title is reported.
If this property contains text or a function handle that returns text, the text is added to an
mlreportgen.dom.Paragraph object with the style BusTitleParagraph.
If this property is specified as a function handle, the function must return content that can be added
to a report, such as a string scalar, character vector, or DOM object. The function must accept a
struct with these fields:
Types of blocks used to report bus information, specified as one of these values:
For models or subsystems, the Bus reporter reports bus information from all blocks of the types that
this property specifies. For signals, the reporter reports bus information from all blocks of the
specified types that are connected to the signal (source and destination). For blocks, this property is
used only if the IncludeNestedBuses property is true. For Bus Selector and In Bus
Element blocks, the reporter reports bus information from all blocks of the specified type that are
connected to the output signals of the block. For Bus Creator, Bus Assignment, and Out Bus
Element blocks, the reporter reports bus information from all blocks of the specified type that are
connected to the input signals of the block.
Whether to report nested buses, specified as true or false. If this property is true, the reporter
reports bus-related blocks of the type specified by ReportedBlockType that are connected to the
selected signals or to signals used to create a bus. If this property is false and Object is a block,
the reporter reports only the block specified by Object. If this property is false and Object is a
signal, the reporter reports only the blocks directly connected to the signal.
7-8
slreportgen.report.Bus class
If Object is a model or subsystem, this property has no effect because all blocks of the type specified
by the ReportedBlockType property are used to report buses.
Whether to report the hierarchy of bus signals for each bus, specified as true or false. If this
property is true, the reporter includes a list of the names of signals in the bus. For blocks that create
buses, the list describes the signal hierarchy of the output bus. For blocks that select signals from
buses, the list describes the signal hierarchy of the input bus. If the bus includes any nested signals,
the signal names are included as a nested list.
The reporter does not include the signal hierarchy for buses created or selected by top-level model
input or output ports.
Whether to report details of signals, specified as true or false. If this property is true, the reporter
includes a table describing the signals selected from a bus or used to create a bus, depending on the
block type.
Whether to report the name of a Simulink.Bus object that is associated with the reported bus,
specified as true or false. If this property is true and the reported bus is described by a
Simulink.BusObject, the report includes the name of the bus object and links the name to the bus
object information reported elsewhere in the report.
The reporter does not include the bus object name for buses created or selected by top-level model
input or output ports.
Whether to report the names of blocks connected to each full bus signal, specified as true or false.
If this property is true:
The reporter does not include the names of connected blocks for buses created or selected by top-
level model input or output ports.
Whether to include a link to a bus created or selected by a connected block, specified as true or
false. If this property is true, the reporter includes a link to the bus information for blocks that are
reported as a source or destination in the signal table or connected blocks sections. For blocks whose
block types are included in ReportedBlockTypes, a Bus Created or Signals Selected link is
included next to the block name.
7-9
7 Classes
Whether to report block names as links to block details, specified as true or false. If this property
is true, a block name in a signal table title links to the block details reported elsewhere in the report.
Whether to report port numbers as links to signal details, specified as true or false. If this property
is true, the reporter reports signal port numbers in the signal table as links to the signal details
reported elsewhere in the report.
Properties to report for the signals selected by Bus Selector or In Bus Element blocks, specified as a
string array or a cell array of character vectors. Specify any of these properties:
Properties to report for the signals used to create a bus by Bus Creator, Bus Assignment, and Out Bus
Element blocks, specified as a string array or a cell array of character vectors. Specify any of these
properties:
Function or expression to filter signals in a signal table, specified as a function handle, string scalar,
or character vector. Specify a function as a function handle. Specify an expression as a string scalar
or character vector. The function or code is executed for each signal that is selected or used to create
a bus.
For example, this code uses the SignalFilterFcn property to filter out the signals that feed into
the Display3 block:
import slreportgen.report.*
import mlreportgen.report.*
model_name = "sldemo_bus_arrays";
load_system(model_name);
rpt = slreportgen.report.Report("Bus_example","pdf");
7-10
slreportgen.report.Bus class
append(rpt,slreportgen.report.Diagram(model_name));
ch = Chapter("Buses");
busRptr = Bus(model_name);
busRptr.SignalFilterFcn = @(~, ~, ~, destinationPath) endsWith(destinationPath,"Display3");
append(ch,busRptr);
append(rpt,ch);
close(rpt);
rptview(rpt);
If you provide a string scalar or a character vector, it must contain an expression. The expression:
For example, this code uses the SignalFilterFcn property to filter out the signals that feed into
the Display4 block:
import slreportgen.report.*
import mlreportgen.report.*
model_name = "sldemo_bus_arrays";
load_system(model_name);
rpt = slreportgen.report.Report("Bus_example","pdf");
append(rpt,slreportgen.report.Diagram(model_name));
ch = Chapter("Buses");
busRptr = Bus(model_name);
filterStr = "isFiltered = endsWith(destinationPath,""Display4"");";
busRptr.SignalFilterFcn = filterStr;
append(ch,busRptr);
append(rpt,ch);
close(rpt);
rptview(rpt);
The default value of this property is an UnorderedList object with the StyleName property set to
the BusList style, which is defined in the default template for a Bus reporter. To customize the
appearance of the list, modify the properties of the default UnorderedList object or replace the
object with your own UnorderedList or OrderedList object.
7-11
7 Classes
ParagraphFormatter — Paragraph formatter for connected blocks and bus object details
mlreportgen.dom.Paragraph object
Paragraph formatter to report and format the connected blocks and bus object details, specified as an
mlreportgen.dom.Paragraph object. The default value of this property is an
mlreportgen.dom.Paragraph object with the StyleName property set to the BusParagraph
style, which is defined in the default template for a Bus reporter. To customize the appearance of the
paragraph, modify the properties of the default mlreportgen.dom.Paragraph object or replace the
object with a customized mlreportgen.dom.Paragraph object. If you add content to the default or
replacement paragraph object, the content appears in front of the content reported for the connected
blocks and bus object details in the generated report.
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source specified by the
TemplateSrc property for this reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
slreportgen.report.Bus.createTemplate Create bus reporter template
slreportgen.report.Bus.customizeReporter Create subclass of slreportgen.report.Bus class
slreportgen.report.Bus.getClassFolder Get location of folder that contains the
slreportgen.report.Bus class definition file
copy Create copy of a Simulink reporter object and make
deep copies of certain property values
getImpl Get implementation of reporter
Examples
7-12
slreportgen.report.Bus class
Use an slreportgen.report.Bus object to report on the buses that are selected by the blocks in a
model.
Import the Report API packages so that you do not have to use long fully qualified class names.
import mlreportgen.report.*
import slreportgen.report.*
model_name = "sldemo_bus_arrays";
load_system(model_name);
rpt = slreportgen.report.Report("Bus_example","pdf");
append(rpt,slreportgen.report.Diagram(model_name));
ch = Chapter("Buses");
busRptr = Bus(model_name);
Use the block name as the title for each block bus.
append(ch,busRptr);
append(rpt,ch);
close(rpt);
rptview(rpt);
See Also
slreportgen.report.BusObject | slreportgen.finder.DiagramResult |
slreportgen.finder.BlockResult | slreportgen.finder.SignalFinder |
slreportgen.finder.SignalResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2021a
7-13
7 Classes
slreportgen.report.BusObject class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Creates a reporter that generates information about a Simulink.Bus object in a report.
Note To use a bus object reporter in a report, you must create the report using the
slreportgen.report.Report class or subclass.
Class Attributes
HandleCompatible true
Creation
Description
Properties
Object — Object that specifies a Simulink.Bus object
slreportgen.finder.ModelVariableResult object | Simulink.VariableUsage object
7-14
slreportgen.report.BusObject class
This read-only property contains the name of bus object to report, specified as a string scalar.
Bus object properties to report, specified as a string array or a cell array of character vectors. The
properties specified by the ReportedBusProperties property are further filtered by the
PropertyFilterFcn property. If the ReportedBusProperties property is empty, the reporter
includes all properties in the report, except the properties filtered by the PropertyFilterFcn
property. The reporter excludes any bus object property that is not valid for the bus object.
Bus element properties to report, specified as a string array or a cell array of character vectors. The
properties specified by the ReportedElementProperties property are further filtered by the
function or code specified in the PropertyFilterFcn property. If the
ReportedElementProperties property is empty, the reporter includes all properties in the report,
except the properties filtered by the PropertyFilterFcn property. The reporter excludes any bus
element property that is not valid for the bus element.
Whether to show the name of the bus object in the report, specified as true or false.
Whether to include a nested list that represents the bus hierarchy in the report, specified as true or
false.
Whether to show the bus object properties table in the report, specified as true or false.
Whether to show the bus element properties table in the report, specified as true or false.
Whether to show a list of the blocks that use the bus object, specified as true or false. If the
ShowUsedBy property is set to true, the reporter includes a list of the blocks that use the bus object
in the report. If the ShowUsedBySnapshot property is also set to true, the reporter includes a
diagram snapshot for each parent subsystem that uses the bus object. Blocks that use the bus object
are highlighted in the snapshot.
7-15
7 Classes
Whether to show diagram snapshots of parent subsystems and highlight the blocks that use the bus
object, specified as true or false. If the ShowUsedBySnapshot property is set to true, the report
includes a snapshot for each parent subsystem that uses the bus object. Blocks that use the bus
object are highlighted in the snapshot. If a parent subsystem has more than one block that uses the
bus object, the reporter shows only one diagram snapshot that highlights the blocks that use the bus
object.
Whether to create a separate section for each type of information about the bus object in the report.
If the CreateSections property is set to true, the reporter creates an
mlreportgen.report.Section with a title for each of these types of information:
If the CreateSections property is set to false, the reporter generates labels for tables and lists.
For a table, the reporter generates a table title. For a list, the reporter generates text that precedes
the list.
UsedByListFormatter — List formatter for blocks that use the bus object
mlreportgen.dom.UnorderedList | mlreportgen.dom.OrderedList
List formatter that formats the generated list of blocks that use the bus object, specified as an
mlreportgen.dom.UnorderedList object or an mlreportgen.dom.OrderedList object. To
customize the list formatting, modify the list object properties or replace the list object with a
customized list object that does not contain list items.
Table reporter used to format the table of bus object properties, specified as an
mlreportgen.report.BaseTable object. To customize the appearance of the table, modify the
properties of the default table reporter or replace it with a customized table reporter. If you add
content to the Title property of the default or customized table reporter, the content appears in
front of the table title in the generated report.
Table reporter used to format the table of bus element properties, specified as an
mlreportgen.report.BaseTable object. To customize the appearance of the table, modify the
properties of the default table reporter or replace it with a customized table reporter. If you add
7-16
slreportgen.report.BusObject class
content to the Title property of the default or customized table reporter, the content appears in
front of the table title in the generated report.
Whether to display properties horizontally in the table of element properties, specified as true or
false.
If the HorizontalElementsTable property is set to true, the table has one column for each
property. For example:
If the HorizontalElementsTable property is set to false, the property and value cells in the row
for the element are split into multiple rows. For example:
Reporter for formatting sections when the CreateSections property is set to true, specified as an
mlreportgen.report.Section object. To customize the appearance of the section, modify the
properties of the default section reporter or replace it with a customized section reporter.
Function or expression to filter the properties of a reported bus or bus element from a report. Specify
a function as a function handle. Specify an expression as a string scalar or character vector.
For example, this code prevents the display of the HeaderFile and Description properties of a
bus object and the Complexity property of a bus element:
import slreportgen.finder.*
import slreportgen.report.*
rpt = slreportgen.report.Report('busrpt','pdf');
7-17
7 Classes
model = load_system('sldemo_bus_arrays');
modelVariableFinder = ModelVariableFinder(model);
results = find(modelVariableFinder);
for result = results
if isa(getVariableValue(result),'Simulink.Bus')
busRptr = slreportgen.report.BusObject(result);
busRptr.PropertyFilterFcn = @busPropertyFilter;
% Create a Chapter
chapter = mlreportgen.report.Chapter(busRptr.Name);
add(chapter, busRptr);
add(rpt,chapter)
end
end
close(rpt);
close_system(model);
rptview(rpt);
If you provide a string scalar or a character vector, it must contain an expression. The expression:
For example, this code filters the HeaderFile property of a bus object from the report:
import slreportgen.finder.*
import slreportgen.report.*
rpt = slreportgen.report.Report('busrpt','pdf');
model = load_system('sldemo_bus_arrays');
modelVariableFinder = ModelVariableFinder(model);
results = find(modelVariableFinder);
for result = results
if isa(getVariableValue(result),'Simulink.Bus')
busRptr = slreportgen.report.BusObject(result);
busRptr.PropertyFilterFcn = "isFiltered = " + ...
"isa(variableObject, 'Simulink.Bus') && " + ...
"propertyName == 'HeaderFile';";
% Create a Chapter
chapter = mlreportgen.report.Chapter(busRptr.Name);
add(chapter, busRptr);
add(rpt,chapter)
end
end
close(rpt);
close_system(model);
rptview(rpt);
7-18
slreportgen.report.BusObject class
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
slreportgen.report.BusObject.createTemplate Create bus object reporter template
slreportgen.report.BusObject.customizeReporter Create custom bus object reporter
slreportgen.report.BusObject.getClassFolder Bus object reporter class definition file location
copy Create copy of a Simulink reporter object and
make deep copies of certain property values
getImpl Get implementation of reporter
Examples
Report on bus objects in a model by using a model variable finder to find all variables used in the
model and then creating a bus reporter for each variable that is a bus object.
% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");
open(rpt);
% Load a model
model_name = "sldemo_bus_arrays";
load_system(model_name);
7-19
7 Classes
while hasNext(finder)
result = next(finder);
if isa(getVariableValue(result), "Simulink.Bus")
% Create a Bus object reporter
busReporter = slreportgen.report.BusObject(result);
% Create a Chapter
chapter = mlreportgen.report.Chapter(busReporter.Name);
% Add bus to chapter
add(chapter, busReporter)
% Add chapter to the report
add(rpt,chapter);
end
end
Customize the reported content and formatting of the content by setting properties of the bus object
reporter. This example uses the ReportedElementProperties property to constrain the element
properties that are reported. It uses the HorizontalElementsTable property to generate a properties
table with one column for each property.
% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");
open(rpt);
% Load a model
model_name = "sldemo_bus_arrays";
load_system(model_name);
7-20
slreportgen.report.BusObject class
close(rpt);
rptview(rpt);
See Also
Simulink.findVars | Simulink.VariableUsage |
slreportgen.finder.ModelVariableResult | slreportgen.report.ModelVariable |
slreportgen.finder.ModelVariableFinder | slreportgen.report.Bus
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
7-21
7 Classes
slreportgen.report.CFunction class
Package: slreportgen.report
Description
Use an object of the slreportgen.report.CFunction class to report on a C Function block.
• A table that includes the Description parameter and any custom mask parameters
• A table that lists the contents of the Symbols parameter
• Sections for the C code defined by the Output Code, Start Code, and Terminate Code
parameters
Note To use a CFunction reporter in a report, you must create the report using the
slreportgen.report.Report class.
Class Attributes
HandleCompatible true
Creation
Description
7-22
slreportgen.report.CFunction class
Properties
Object — Simulink C Function block to report
[] (default) | string scalar | character vector | handle | slreportgen.report.BlockResult object
Note If you use a finder to find C Function blocks and add the results directly to a report, the blocks
are reported using slreportgen.report.CFunction reporters, instead of
slreportgen.report.SimulinkObjectProperties reporters.
Whether to include a table of block parameters, specified as true or false. If this property is true,
the reporter generates a table that includes the Description parameter and any custom mask
parameters, by default. The Output Code, Start Code, Terminate Code, and Symbols parameters
are not included in this table because they are reported in separate sections. Use the
ObjectPropertiesReporter property of this reporter to specify the parameters that the table
includes or to customize the table format. If the parameters are empty, the reporter does not
generate a table.
Attributes:
GetAccess public
SetAccess public
Whether to include a table of the symbols used by the C Function block, specified as true or false.
Attributes:
GetAccess public
SetAccess public
Whether to include the C code used to compute the outputs of the C Function block, specified as
true or false.
Attributes:
GetAccess public
SetAccess public
Whether to include the C code used to compute the starting state of the C Function block, specified
as true or false.
7-23
7 Classes
Attributes:
GetAccess public
SetAccess public
Whether to include the C code that the C Function block executes when it terminates, specified as
true or false.
Attributes:
GetAccess public
SetAccess public
GetAccess public
SetAccess public
Formatter for the table of symbols used by the C Function block, specified as an
mlreportgen.report.BaseTable object. The default value of this property is an empty
BaseTable object with the StyleName property set to "CFunctionSymbolsTable". You can
customize the appearance of the table of symbols by modifying the properties of the default object or
by replacing it with another BaseTable object. Any content added to the title property of the
BaseTable object appears before the default generated table title in the report.
Attributes:
GetAccess public
SetAccess public
Data Types:
Paragraph formatter for the titles of the output, start, and terminate code sections of the report,
specified as an mlreportgen.dom.Paragraph object. The default value of this property is an empty
Paragraph object with the StyleName property set to "CFunctionCodeTitle". You can customize
7-24
slreportgen.report.CFunction class
the appearance of the code section titles by modifying the properties of the default object or by
replacing it with another Paragraph object. Any content added to the Paragraph object in this
property appears before the code titles in the report.
Attributes:
GetAccess public
SetAccess public
Data Types:
Formatter for the C code in the output, start and terminate code sections of the report, specified as
an mlreportgen.dom.Preformatted object. The default value of this property is an empty
Preformatted object with StyleName set to "CFunctionCode". You can customize the
appearance of the C code by modifying the properties of the default object or by replacing it with
another Preformatted object. Any content added to the Preformatted object in this property
appears before the formatted code in the report.
Attributes:
GetAccess public
SetAccess public
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Attributes:
GetAccess public
SetAccess public
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template specified by the TemplateSrc
property of this reporter.
Attributes:
GetAccess public
SetAccess public
7-25
7 Classes
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Attributes:
GetAccess public
SetAccess public
Methods
Public Methods
slreportgen.report.CFunction.createTemplate Create C Function block reporter template
slreportgen.report.CFunction.customizeReporter Create subclass of slreportgen.report.CFunction
class
slreportgen.report.CFunction.getClassFolder Get location of folder that contains the
slreportgen.report.CFunction class definition file
copy Create copy of a Simulink reporter object and
make deep copies of certain property values
getImpl Get implementation of reporter
Examples
This example generates a report that includes information about a C Function block used in a model.
Import the Report API packages so that you do not have to use long, fully qualified class names.
import mlreportgen.report.*
import slreportgen.report.*
Create a report.
rpt = slreportgen.report.Report("output","pdf");
model_name = "slrgex_cfunction";
cFcnObj = "slrgex_cfunction/C Function";
load_system(model_name);
chapter = Chapter(cFcnObj);
Create a C Function block reporter. By default, the reporter includes the Output Code, Start Code,
Terminate Code, and Symbols parameters, as well as any other block parameters in the report. The
Terminate Code parameter of the C Function block in this example is empty.
rptr = CFunction(cFcnObj);
Add the C Function reporter to the chapter and chapter to the report.
7-26
slreportgen.report.CFunction class
append(chapter,rptr);
append(rpt,chapter);
close(rpt);
close_system(model_name);
rptview(rpt);
See Also
slreportgen.report.Report | slreportgen.finder.BlockFinder |
slreportgen.finder.BlockResult | slreportgen.report.SimulinkObjectProperties
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2021b
7-27
7 Classes
slreportgen.report.DataDictionary class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Use an object of the slreportgen.report.DataDictionary class to report on a Simulink data
dictionary. Create a DataDictionary object to report on a specific data dictionary. Alternatively, use
an slreportgen.finder.DataDictionaryFinder object to find data dictionaries and use the
getReporter method of an slreportgen.finder.DataDictionaryResult object to return the
reporter for the result.
Class Attributes
HandleCompatible true
Creation
Description
Properties
Dictionary — Data dictionary to report
character vector | string scalar
7-28
slreportgen.report.DataDictionary class
Data dictionary to report, specified as a character vector or string scalar that contains the file name
of a dictionary on the MATLAB path or the path and file name of a data dictionary. The path can be
relative or absolute.
Example: "sldemo_fuelsys_dd.sldd"
Example: "myDictionaries/myDataDictionary.sldd"
Attributes:
GetAccess public
SetAccess public
Properties to report for each data dictionary entry in the summaries table, specified as a string array
or cell array of character vectors. Valid properties are:
The Value entry contains the value if the data type is numeric scalar, logical scalar, string scalar, or
character vector. Otherwise, the Value entry is See details.
Example: ["Name" "Value" "Class" "LastModified" "LastModifiedBy" "Status"
"DataSource"]
Example: {'Name' 'Value' 'Class'}
Attributes:
GetAccess public
SetAccess public
Whether to report the Design Data section of the data dictionary, specified as true or false.
Attributes:
GetAccess public
SetAccess public
Whether to report the Configurations section of the data dictionary, specified as true or false.
Attributes:
GetAccess public
SetAccess public
7-29
7 Classes
Whether to report the Other Data section of the data dictionary, specified as true or false.
Attributes:
GetAccess public
SetAccess public
Whether to include the dictionaries that are referenced by the dictionary that this reporter reports,
specified as true or false. The ReferencedDictionaryPolicy property determines how
referenced dictionaries are reported.
Attributes:
GetAccess public
SetAccess public
Display policy for reporting a referenced dictionary, specified as one of these values:
Attributes:
GetAccess public
SetAccess public
Data dictionary entry filter, specified as a function handle, string scalar, or character vector. If you do
not provide EntryFilterFcn, all entries are included in the report.
For example, this code uses the EntryFilterFcn property to prevent reporting of entries that are
Simulink.Parameter objects:
rpt = slreportgen.report.Report("MyReport","pdf");
ddPath = which("slrgex_fuelsys.sldd");
ch = mlreportgen.report.Chapter("slrgex_fuelsys.sldd");
rptr = slreportgen.report.DataDictionary(ddPath);
append(ch,rptr);
7-30
slreportgen.report.DataDictionary class
append(rpt,ch);
close(rpt);
rptview(rpt);
If you provide a string scalar or a character vector, it must contain an expression. The expression:
For example, this code uses the EntryFilterFcn property to prevent reporting of entries that are
Simulink.Bus objects:
rpt = slreportgen.report.Report("MyReport","pdf");
ddPath = which("slrgex_fuelsys.sldd");
ch = mlreportgen.report.Chapter("slrgex_fuelsys.sldd");
rptr = slreportgen.report.DataDictionary(ddPath);
filterStr = "isFiltered = isa(entryValue,'Simulink.Bus');";
rptr.EntryFilterFcn = filterStr;
append(ch,rptr);
append(rpt,ch);
close(rpt);
rptview(rpt);
Attributes:
GetAccess public
SetAccess public
Attributes:
GetAccess public
SetAccess public
DetailsReporter — Formatter for reporting design data and other data entry details
mlreportgen.report.MATLABVariable object
Formatter for reporting the details of the entry values in the Design Data and Other Data sections
of the data dictionary, specified as an mlreportgen.report.MATLABVariable object. The default
value of this property is a MATLABVariable object with default property values. To customize the
appearance of the entry details, modify the properties of the default MATLABVariable object or
replace the object with your own MATLABVariable reporter. The Variable, Location, and
LinkTarget properties of the MATLABVariable reporter are ignored.
7-31
7 Classes
Attributes:
GetAccess public
SetAccess public
Formatter for reporting the details about the entry values in the Configurations section of a data
dictionary, specified as an slreportgen.report.ModelConfiguration object. The default value
of this property is a ModelConfiguration object with default property values. To customize the
appearance of the entry details, modify the properties of the default object or replace it with your
own ModelConfiguration object. The Model and LinkTarget properties of the reporter are
ignored.
Attributes:
GetAccess public
SetAccess public
The default value of this property is an UnorderedList object with the StyleName property set to
the DataDictionaryList style, which is defined in the default template of a DataDictionary
reporter. To customize the appearance of the list, modify the properties of the default
UnorderedList object or replace the object with your own UnorderedList or OrderedList
object.
Attributes:
GetAccess public
SetAccess public
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Attributes:
GetAccess public
SetAccess public
7-32
slreportgen.report.DataDictionary class
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template specified by the TemplateSrc
property of this reporter.
Attributes:
GetAccess public
SetAccess public
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Attributes:
GetAccess public
SetAccess public
Methods
Public Methods
slreportgen.report.DataDictionary.createTemplate Copy the default
slreportgen.report.DataDictionary reporter
template
slreportgen.report.DataDictionary.customizeReporter Create subclass of
slreportgen.report.DataDictionary class
slreportgen.report.DataDictionary.getClassFolder Get location of folder that contains the
slreportgen.report.DataDictionary class
definition file
copy Create copy of a Simulink reporter object and
make deep copies of certain property values
getImpl Get implementation of reporter
Examples
Import the MATLAB Report and Simulink Report API packages so that you do not have to use long,
fully qualified class names.
import slreportgen.report.*
import mlreportgen.report.*
rpt = slreportgen.report.Report("MyReport","pdf");
7-33
7 Classes
Specify the path of the data dictionary used by the model slrgex_fuelsys.
ddPath = which("slrgex_fuelsys.sldd");
ch = Chapter("slrgex_fuelsys.sldd");
rptr = DataDictionary(ddPath);
Append the reporter to the chapter and the chapter to the report.
append(ch,rptr);
append(rpt,ch);
close(rpt);
rptview(rpt);
See Also
slreportgen.finder.DataDictionaryFinder |
slreportgen.finder.DataDictionaryResult | slreportgen.report.Report
Topics
“What Is a Data Dictionary?”
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2020b
7-34
slreportgen.report.Diagram class
slreportgen.report.Diagram class
Package: slreportgen.report
Description
Create a diagram reporter, including a diagram snapshot and caption, for a Simulink or Stateflow
diagram.
Note To use a Diagram reporter in a report, you must create the report using the
slreportgen.report.Report class.
Construction
diagram = Diagram() creates an empty diagram reporter. Set its properties to capture a Simulink
or Stateflow diagram.
diagram = Diagram(source) creates a diagram reporter for the Simulink or Stateflow diagram
specified by source. Adding this reporter to a report creates a snapshot of the diagram. Then, the
snapshot displays in the report as an image with a caption. The snapshot image is stored in the
temporary folder of the report. When the report is closed, the snapshot image is copied into the
report and then, the image is deleted from the temporary folder. To prevent the snapshot image file
from being deleted, use the Debug property of the report. See slreportgen.report.Report
diagram = Diagram(Name,Value) sets properties using name-value pairs. You can specify
multiple name-value pair arguments in any order. Enclose each property name in single or double
quotes.
Input Arguments
Properties
Source — Diagram snapshot image source
string scalar | character vector | handle | slreportgen.finder.DiagramResult | ...
7-35
7 Classes
• Stateflow.Chart or Stateflow subchart object. Subcharts are graphical objects that can contain
the same objects as a top-level chart, including other subcharts. Subcharts are commonly
specified by a Stateflow.State, Stateflow.Function, or Stateflow.Box object.
Diagram area to capture in the snapshot, specified as a 1-by-4 array of doubles. The first two values
of the array are the x and y coordinates, in pixels, of the top left corner of the diagram area in the
Simulink Editor coordinate space. The last two values are the width and height, in pixels. An empty
array specifies the entire diagram.
You can set up the view that you want to capture in the Simulink Editor and then set the
SnapshotArea property to the output of the slreportgen.utils.getCurrentEditorView
function. For an example, see “Take Snapshot of Part of a Diagram” on page 7-42.
Snapshot image format, specified as a character vector or string scalar. Supported formats are:
Choice to include a hyperlink of each diagram element, specified as a logical. If this property is true,
each element becomes a hyperlink to an object in the report that describes it. This property applies
only to PDF and HTML reports. Hyperlinks allow you to navigate the report using Simulink and
Stateflow charts.
7-36
slreportgen.report.Diagram class
corresponding element-based target ID. The report object to which a diagram element links depends
on the element type.
• A diagram-based block (subsystem, chart, model) links to the diagram of the block.
• Other blocks link to textual block descriptions, typically block property tables.
• Masked subsystem blocks that have mask parameters link to the textual description of the block,
such as the mask parameter tables. This linking to the textual descriptions is true only if the
MaskedSystemLinkPolicy property of the Diagram reporter is set to 'block' or 'default'.
Otherwise, the masked system block links to its diagram.
• Masked subsystem blocks that do not have mask parameters link to the diagram of the block.
To customize diagram-based navigation, create custom link targets based on target IDs generated by
the slreportgen.utils.getObjectID utility function.
Policy to determine the targets for the hyperlinks of masked system blocks, specified as one of these
values.
• 'default' — Masked system blocks that have parameters link to textual descriptions, such as
mask parameter tables. Masked system blocks that do not have parameters link to the
corresponding block diagram in the report.
• 'system' — Masked system blocks link to their block diagram in the report.
• 'block' — Masked system blocks link to their textual description, such as a table of masked
parameters or subsystem parameters.
Scaling options for diagram snapshot image, specified as the string, auto, custom, or zoom.
Scaling controls size of the diagram snapshot image in the image file.
• auto — For PDF or Word (docx) output, auto scales the diagram snapshot image to fit in the
current page layout while maintaining its aspect ratio. First, the diagram snapshot image is scaled
to the page width. If the image height exceeds the page height, then the image is again scaled
down. This additional scaling assures that the image fits in the current page with an extra 1"
spacing. The extra spacing allows for extra text, such as a caption. Scaling does not apply to
HTML output.
• custom — Scales the diagram snapshot image based on the values of the Height and Width
properties
• zoom — Enlarges or reduces the snapshot image size to the percent value specified by the Zoom
property. To specify the maximum image height and maximum image width, use the MaxHeight
and MaxWidth properties, respectively.
• Scaling set to zoom, and Zoom, MaxHeight, and MaxWidth properties set to large values
• Scaling set to custom, and Height and Width properties set to large values
7-37
7 Classes
To avoid this error, for zoom Scaling, use smaller Zoom, MaxHeight, and MaxWidth property
values. For custom Scaling, use smaller Height and Width property values. Using smaller values
ensures that the diagram fits on the page.
Height of snapshot image, specified as a character vector or string scalar that consists of a number
followed by an abbreviation for a unit of measurement. For example, '2in' specifies two inches. Valid
abbreviations are:
• px — pixels (default)
• cm — centimeters
• in — inches
• mm — millimeters
• pc — picas
• pt — points
Example: '2in'
Width of snapshot image, specified as a character vector or string scalar that consists of a number
followed by an abbreviation for a unit of measurement. For example, '2in' specifies two inches. Valid
abbreviations are:
• px — pixels (default)
• cm — centimeters
• in — inches
• mm — millimeters
• pc — picas
• pt — points
Example: '3in'
Amount to zoom the diagram snapshot image, specified as a string. The Zoom format is value%,
where value is the percentage by which the diagram snapshot image is enlarged or reduced.
Maximum height for zoom scaling, specified as a string. This property applies only if Scaling is set
to zoom.
The MaxHeight format is valueUnits, where Units is an abbreviation for the height units and value is
the number of units. See the Height property for a table of valid Units abbreviations.
7-38
slreportgen.report.Diagram class
Maximum width for zoom scaling, specified as a string. This property applies only if Scaling is set to
zoom.
The MaxWidth format is valueUnits, where Units is an abbreviation for the height units and value is
the number of units. See the Height property for a table of valid Units abbreviations.
Source of the template for this reporter, specified in one of these ways:
• Character vector or string scalar that specifies the path of the file that contains the template for
this reporter
• Reporter or report whose template is used for this reporter or whose template library contains the
template for this reporter
• DOM document or document part whose template is used for this reporter or whose template
library contains the template for this reporter
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
7-39
7 Classes
Inherited Methods
Examples
Add Top Level of Model Diagram
load_system("slrgex_vdp")
import slreportgen.report.*
import mlreportgen.report.*
rpt = slreportgen.report.Report("output","pdf");
chapter = Chapter();
chapter.Title = "Diagram Reporter Example";
diagram = Diagram("slrgex_vdp");
diagram.Snapshot.Caption = "The van der Pol Equation";
diagram.SnapshotFormat = "svg";
diagram.Snapshot.Height = "4in";
add(chapter,diagram);
add(rpt,chapter);
rptview(rpt);
7-40
slreportgen.report.Diagram class
Create a PDF report and add diagram snapshots of the root system and a subsystem from the
slrgex_sf_car model to it. Add a hyperlink to the transmission subsystem and add a paragraph as
the target for that link.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.utils.*
import mlreportgen.dom.*
rpt = slreportgen.report.Report('output','pdf');
chapter = Chapter('slrgex_sf_car');
load_system('slrgex_sf_car');
diag1 = Diagram('slrgex_sf_car');
diag1.Snapshot.Caption = 'Root System: slrgex_sf_car';
add(chapter,diag1);
add(chapter,PageBreak);
diag2 = Diagram('slrgex_sf_car/Engine');
diag2.Snapshot.Caption = 'Subsystem: slrgex_sf_car/Engine';
add(chapter,diag2);
add(chapter, PageBreak);
7-41
7 Classes
add(chapter,para);
add(chapter,PageBreak);
add(rpt, chapter);
close(rpt);
rptview(rpt);
Use the SnapshotArea property to specify the area of the diagram to capture in the snapshot. This
example sets up the view in the Simulink Editor and then sets the SnapshotArea property to that
view by calling slreportgen.utils.getCurrentEditorView.
f14
In the Simulink Editor, display the part of the diagram that you want to capture in the snapshot. Get
the current Simulink Editor view area by calling slreportgen.utils.getCurrentEditorView.
editorViewArea = getCurrentEditorView();
Create the report and diagram reporter. Set the diagram snapshot area to the current editor viewing
area. Add the diagram reporter to the report.
import slreportgen.report.*
import Slreportgen.utils.*
rpt = Report('output','pdf');
diag = Diagram('f14');
diag.SnapshotArea = editorViewArea;
add(rpt, diag);
7-42
slreportgen.report.Diagram class
close(rpt);
rptview(rpt);
Compatibility Considerations
Default value of SnapshotFormat is 'svg' for all report types
Behavior changed in R2019b
Starting in R2019b, Scalable Vector Graphics (SVG) images are supported for Word reports. For all
report types (HTML, PDF, and Word), the default value of the SnapshotFormat property is 'svg'
and a value of 'auto' indicates 'svg'. In previous releases, the default value of the
SnapshotFormat property was 'auto', which indicated 'svg' for HTML and PDF reports and
'emf' or 'png' for Word reports, depending on the platform.
Word reports that contain SVG images require Word 2016 or a later version. In MATLAB R2019b or a
later release, to generate a report with images that are compatible with earlier versions of Word, set
the SnapshotFormat property to a value other than 'svg'. To specify the image format used by
default in earlier releases of MATLAB, set SnapshotFormat to:
See Also
slreportgen.report.Report | slreportgen.finder.DiagramFinder |
slreportgen.finder.DiagramElementFinder |
slreportgen.finder.SystemDiagramFinder | slreportgen.finder.ChartDiagramFinder |
slreportgen.finder.StateflowDiagramElementFinder |
slreportgen.finder.StateFinder | slreportgen.report.StateflowObjectProperties |
slreportgen.report.SimulinkObjectProperties | slreportgen.finder.BlockFinder |
slreportgen.finder.AnnotationFinder
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-43
7 Classes
slreportgen.report.DocBlock class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
DocBlock reporter
Description
Use an object of the slreportgen.report.DocBlock class to report on a DocBlock block.
Note To use a DocBlock reporter in a report, you must create the report using the
slreportgen.report.Report class or subclass.
The reporter includes the DocBlock content in a report in one of these ways:
The table shows when the reporter includes, links to, or embeds the content, depending on the
DocBlock content type, the report type, and the values of the ConvertHTML and EmbedFile
properties.
7-44
slreportgen.report.DocBlock class
Class Attributes
HandleCompatible true
Creation
Description
Properties
Object — Simulink DocBlock block
[] (default) | string scalar | character vector | handle
Simulink DocBlock block, specified as a string scalar or character vector that contains the path to a
DocBlock or as a handle to a DocBlock block.
Note If you use a finder to find DocBlock blocks and add the results directly to a report, DocBlock
reporters are used to report on the DocBlock blocks rather than Simulink object property reporters.
7-45
7 Classes
Whether to import plain text content in line, specified as true or false. If ImportTextInline is
false, before the reporter appends the content to a hole, it wraps the content in one or more
paragraphs, depending on the value of the TexSep property. Set ImportTextInline to true to
append DocBlock text content to a hole in a paragraph (an inline hole).
Separator used to delimit paragraphs in plain text content, specified as one of the values in the table.
You can specify the value as a string scalar or a character vector.
Value Description
"Ignore" Wrap text in a single paragraph regardless of
whether it contains separators. (default)
"LineFeed" If a text segment ends with a line feed, wrap it in
a paragraph.
"BlankLine" If a text segment ends with a blank line, wrap it
in a paragraph.
Whether to include HTML content, specified as true or false.This property applies only to Word
and PDF reports.
If the value is true, HTML content is converted to DOM objects and appended to a report.
If the report is an HTML or HTML file report, the HTML content is included in the report, regardless
of the value of the ConvertHTML property.
Whether to embed the content of a DocBlock block in the generated report, specified as true or
false. This property applies only to HTML or RTF content with PDF reports and to RTF content with
HTML reports. If the value is true, the reporter embeds the DocBlock content in the report and
inserts a hyperlink to the embedded file.
Paragraph formatter object that formats plain text if the ImportTextInline property is false,
specified as an mlreportgen.dom.Paragraph object. The initial value of the
ParagraphFormatter property is an mlreportgen.dom.Paragraph object with default property
values. To customize the appearance of the paragraph, modify the mlreportgen.dom.Paragraph
object properties or replace the object with a customized mlreportgen.dom.Paragraph object. If
you add content to the default or replacement paragraph object, the content appears in front of the
DocBlock content in the generated report.
7-46
slreportgen.report.DocBlock class
Text formatter object that formats plain text if the ImportTextInline property is true, specified as
an mlreportgen.dom.Text object. The initial value of the TextFormatter property is an
mlreportgen.dom.Text object with default property values. To customize the appearance of the
text, modify the mlreportgen.dom.Text object properties or replace the object with a customized
mlreportgen.dom.Text object. If you add content to the default or replacement paragraph object,
the content appears in front of the DocBlock content in the generated report.
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
slreportgen.report.DocBlock.createTemplate Create DocBlock reporter template
slreportgen.report.DocBlock.customizeReporter Create custom DocBlock reporter class
slreportgen.report.DocBlock.getClassFolder Get location of DocBlock reporter class definition
file
copy Create copy of a Simulink reporter object and
make deep copies of certain property values
getImpl Get implementation of reporter
Examples
Include the content from the Sensor Info DocBlock of the slrgex_fuelsys model in a report by
adding a DocBlock reporter to the report. Specify that paragraphs in the DocBlock are delimited by
a linefeed.
7-47
7 Classes
% Create a report
rpt = slreportgen.report.Report("output","pdf");
Here is the content from the Sensor Info DocBlock in the generated report:
7-48
slreportgen.report.DocBlock class
See Also
slreportgen.finder.BlockFinder | DocBlock | slreportgen.utils.isDocBlock
Topics
“Reporting on DocBlock Blocks” on page 4-37
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
7-49
7 Classes
slreportgen.report.ElementDiagram class
Package: slreportgen.report
Description
Create a Simulink or Stateflow element diagram reporter. When added to a report, the
ElementDiagram reporter creates a snapshot of an element. The reporter adds the snapshot to the
report in the form of an image with a caption. Use the “Source” on page 7-0 property to specify the
desired element.
Note To use an ElementDiagram reporter in a report, you must create the report using the
slreportgen.report.Report class.
Construction
diagram = ElementDiagram() creates an empty element diagram reporter. Set its properties to
capture a Simulink or Stateflow element snapshot.
Input Arguments
Properties
Source — Diagram element source
character vector | string scalar | handle | object | slreportgen.finder.DiagramElementResult
object
• Character vector or string scalar that contains the path to a Simulink block or Stateflow chart
block
• Handle to a Simulink block or Stateflow chart block
• Stateflow object
7-50
slreportgen.report.ElementDiagram class
Note Simulink.Port objects are not valid sources for this reporter.
Snapshot image format, specified as a character vector or string scalar. Supported formats are:
Options for scaling a diagram element image, specified as a string or character vector. Valid scaling
options are:
• auto — For PDF or Word (docx) output, auto scales the element image to fit on a page while
maintaining its aspect ratio. First, the element image is scaled to the page width. If the image
height exceeds the page height, the image is again scaled down. This additional scaling ensures
that the image fits the current page with a 1" margin. The margin allows space for a caption.
Scaling does not apply to HTML output.
• custom — Sets the element image height and width to the values of this reporter's Height and
Width properties.
• zoom — Enlarges or reduces the element image size to the percent value specified by this
reporter's Zoom property. To specify the maximum image height and maximum image width, use
the MaxHeight and MaxWidth properties, respectively.
7-51
7 Classes
• Scaling set to zoom, and Zoom, MaxHeight, and MaxWidth properties set to large values
• Scaling set to custom, and Height and Width properties set to large values
To avoid this error, for zoom Scaling, use smaller Zoom, MaxHeight, and MaxWidth property
values. For custom Scaling, use smaller Height and Width property values. Using smaller values
ensures that the diagram fits on the page.
Height to set diagram element image, specified as a string. This property applies only if this
reporter's Scaling property is set to custom.
The Height format is valueUnits, where Units is an abbreviation for the height units and value is the
number of units. The table shows the valid Units abbreviations.
Width to set diagram element image, specified as a string. This property applies only if this reporter's
Scaling property is set to custom.
The Width format is valueUnits, where Units is an abbreviation for the height units and value is the
number of units. See the Height property for a table of valid Units abbreviations.
Amount to zoom the diagram element image, specified as a string. The Zoom format is value%, where
value is the percentage by which the diagram element image is enlarged or reduced.
Maximum height for zoom scaling, specified as a string. This property applies only if this reporter's
Scaling property is set to zoom. The MaxHeight format is valueUnits, where Units is an
abbreviation for the height units and value is the number of units. See this reporter's Height
property for a table of valid Units abbreviations.
Maximum width for zoom scaling, specified as a string. This property applies only if this reporter's
Scaling property is set to zoom. The MaxWidth format is valueUnits, where Units is an abbreviation
7-52
slreportgen.report.ElementDiagram class
for the height units and value is the number of units. See this reporter's Height property for a table
of valid Units abbreviations.
Source of the template for this reporter, specified in one of these ways:
• Character vector or string scalar that specifies the path of the file that contains the template for
this reporter
• Reporter or report whose template is used for this reporter or whose template library contains the
template for this reporter
• DOM document or document part whose template is used for this reporter or whose template
library contains the template for this reporter
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Inherited Methods
7-53
7 Classes
Examples
Add Element Diagram and Caption
import slreportgen.report.*
import mlreportgen.report.*
load_system('f14')
rpt = slreportgen.report.Report("output","pdf");
open(rpt)
chap = Chapter();
chap.Title = "Element Diagram Reporter Example";
add(chap,diag)
add(rpt,chap)
close(rpt)
rptview(rpt)
load_system('f14')
modelsys = "f14/Aircraft Dynamics Model";
rpt = slreportgen.report.Report("output","pdf");
open(rpt)
chapter = mlreportgen.report.Chapter();
chapter.Title = "Element Snapshots";
diag = slreportgen.report.ElementDiagram(modelsys);
add (chapter,diag)
7-54
slreportgen.report.ElementDiagram class
blkfinder = slreportgen.finder.BlockFinder(modelsys);
blks = find(blkfinder);
for blk = blks
blkDiag = slreportgen.report.ElementDiagram...
(blk.Object);
blkDiag.Snapshot.Caption = strcat(blk.DiagramPath,...
"/", blk.Name);
add(chapter,blkDiag) % Add diagram element image
add(chapter,blk) % Add property table
end
add(rpt,chapter)
close(rpt)
rptview(rpt)
7-55
7 Classes
Compatibility Considerations
Default value of SnapshotFormat is 'svg' for all report types
Behavior changed in R2019b
7-56
slreportgen.report.ElementDiagram class
Starting in R2019b, Scalable Vector Graphics (SVG) images are supported for Word reports. For all
report types (HTML, PDF, and Word), the default value of the SnapshotFormat property is 'svg'
and a value of 'auto' indicates 'svg'. In previous releases, the default value of the
SnapshotFormat property was 'auto', which indicated 'svg' for HTML and PDF reports and
'emf' or 'png' for Word reports, depending on the platform.
Word reports that contain SVG images require Word 2016 or a later version. In MATLAB R2019b or a
later release, to generate a report with images that are compatible with earlier versions of Word, set
the SnapshotFormat property to a value other than 'svg'. To specify the image format used by
default in earlier releases of MATLAB, set SnapshotFormat to:
See Also
slreportgen.finder.BlockFinder | slreportgen.finder.StateFinder |
slreportgen.report.Report | slreportgen.report.Diagram |
slreportgen.finder.DiagramElementFinder |
slreportgen.finder.StateflowDiagramElementFinder
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2018b
7-57
7 Classes
slreportgen.report.ExecutionOrder class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Use an object of the slreportgen.report.ExecutionOrder class to report the tasks of a model
or nonvirtual subsystem and the blocks in each task, sorted by execution order. By default, an
ExecutionOrder reporter generates:
Conditionally executed blocks, such as subsystems triggered by a function call or an If block, are not
displayed in the block execution order list. Instead, these blocks are displayed in a Conditional
Execution table that follows the block execution order list. The table lists the conditionally executed
blocks and the blocks that trigger their execution.
Use the ExecutionOrder reporter properties to filter the reported content and customize the
content formatting.
Class Attributes
HandleCompatible true
Creation
Description
7-58
slreportgen.report.ExecutionOrder class
Properties
Object — Model or nonvirtual subsystem block to report
[] (default) | character vector | string scalar | handle | slreportgen.finder.DiagramResult
object | slreportgen.finder.BlockResult
Model or nonvirtual subsystem block to report, specified as one of these types of values:
Whether to include a task details table, specified as true or false. If ShowTaskDetails is true,
the reporter generates a table that displays names and properties of tasks in the specified system.
Data Types: logical
Properties to report for each system task, specified as a string array or cell array of character
vectors. By default, all properties are included. Valid properties are:
Whether to show empty columns in the task details table, specified as true or false. If
ShowEmptyColumns is true, the task details table includes columns that do not have any data.
Data Types: logical
7-59
7 Classes
Whether to show the type of each block in the block execution order lists, specified as true or
false. If ShowBlocktype is true, the reporter includes the type of each block next to the block
name in the execution order lists.
Data Types: logical
Whether to show blocks created at compile time, specified as true or false. If ShowHiddenBlocks
is true, the reporter includes blocks that Simulink inserts when the model is compiled. If
ShowHiddenBlocks is false, the reporter includes only user-added blocks.
Data Types: logical
Policy for referencing execution order lists of blocks that are in nonvirtual subsystems, specified as
one of these string scalars or character vectors:
Function or expression to filter system tasks from a report, specified as a function handle, string
scalar, or character vector. Specify a function as a function handle. Specify an expression as a string
scalar or character vector. If TaskFilterFcn is empty, all tasks are included in the report.
For example, this code uses the TaskFilterFcn property to report only periodic tasks:
import slreportgen.finder.*
import slreportgen.report.*
import mlreportgen.report.*
model_name = "slrgex_vdp";
load_system(model_name);
rpt = slreportgen.report.Report("ExecutionOrder_example","html");
finder = DiagramFinder(model_name);
ch = Chapter("Diagrams");
7-60
slreportgen.report.ExecutionOrder class
while hasNext(finder)
result = next(finder);
% Only report block diagrams and nonvirtual subsystems
if (strcmpi(result.Type,"Simulink.SubSystem")...
&& strcmpi(get_param(result.Object,"IsSubsystemVirtual"),"off")) ...
|| strcmpi(result.Type,"Simulink.BlockDiagram")
sect = Section(result.Name);
append(sect,result);
% Create ExecutionOrder reporter and add to report
rptr = ExecutionOrder(result);
% Filter all but periodic tasks
filterFcnHandle = @(taskName, taskType, trigger, sourceBlock) ...
~strcmpi(taskType, "Periodic");
rptr.TaskFilterFcn = filterFcnHandle;
append(sect,rptr);
append(ch,sect);
end
end
append(rpt,ch);
close(rpt);
rptview(rpt);
If you provide a string scalar or a character vector, it must contain an expression. The expression:
For example, this code uses the TaskFilterFcn property to report only periodic tasks:
import slreportgen.finder.*
import slreportgen.report.*
import mlreportgen.report.*
model_name = "slrgex_vdp";
load_system(model_name);
rpt = slreportgen.report.Report("ExecutionOrder_example","html");
finder = DiagramFinder(model_name);
ch = Chapter("Diagrams");
while hasNext(finder)
result = next(finder);
% Only report block diagrams and nonvirtual subsystems
if (strcmpi(result.Type,"Simulink.SubSystem")...
&& strcmpi(get_param(result.Object,"IsSubsystemVirtual"),"off")) ...
|| strcmpi(result.Type,"Simulink.BlockDiagram")
sect = Section(result.Name);
append(sect,result);
% Create ExecutionOrder reporter and add to report
rptr = ExecutionOrder(result);
% Filter all but periodic tasks
% Code string to include only asynchronous tasks
filterStr = "isFiltered = ~strcmpi(taskType, ""Periodic"");";
rptr.TaskFilterFcn = filterStr;
append(sect,rptr);
append(ch,sect);
end
end
append(rpt,ch);
close(rpt);
rptview(rpt);
Formatter for the task details table, specified as an mlreportgen.report.BaseTable object. The
default value of this property is a BaseTable object with the TableStyleName property set to the
7-61
7 Classes
The default value of this property is an OrderedList object with the StyleName property set to the
ExecutionOrderList style, which is defined in the default template for an ExecutionOrder
reporter. To customize the appearance of the list, modify the properties of the default OrderedList
object or replace the object with a your own OrderedList or UnorderedList object.
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
slreportgen.report.ExecutionOrder.createTemplate Create execution order reporter template
slreportgen.report.ExecutionOrder.customizeReporter Create custom execution order reporter
class
slreportgen.report.ExecutionOrder.getClassFolder Get location of execution order reporter
class definition file
7-62
slreportgen.report.ExecutionOrder class
Examples
For each block diagram or virtual subsystem of the slrgex_vdp model, report the system tasks and
the blocks in each task, in execution order.
Import the MATLAB and Simulink Report API packages so that you do not have to use long, fully
qualified class names.
import mlreportgen.report.*
import slreportgen.finder.*
import slreportgen.report.*
model_name = 'slrgex_vdp';
load_system(model_name);
rpt = slreportgen.report.Report("ExecutionOrder_example","pdf");
Create a finder to find all of the diagrams in the model. Create a Diagrams chapter.
finder = DiagramFinder(model_name);
ch = Chapter("Diagrams");
For each diagram that is a block diagram or a nonvirtual subsystem, report the system tasks and
blocks in execution order, using the default values of the slreportgen.report.ExecutionOrder
reporter properties.
while hasNext(finder)
result = next(finder);
if (strcmpi(result.Type,"Simulink.SubSystem") &&...
strcmpi(get_param(result.Object,"IsSubsystemVirtual"),"off")) ...
|| strcmpi(result.Type,"Simulink.BlockDiagram")
sect = mlreportgen.report.Section(result.Name);
append(sect,result);
rptr = slreportgen.report.ExecutionOrder(result);
append(sect,rptr);
append(ch,sect);
end
end
Append the chapter to the report. Close and view the report.
append(rpt,ch);
close(rpt);
rptview(rpt);
7-63
7 Classes
See Also
slreportgen.finder.BlockResult | slreportgen.finder.DiagramResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2020b
7-64
slreportgen.report.LookupTable class
slreportgen.report.LookupTable class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Create a Simulink lookup table block reporter. See the Object property for a list of supported blocks.
Note To use a LookupTable reporter in a report, you must create the report using the
slreportgen.report.Report class.
Construction
rptr = LookupTable() creates an empty LookupTable block reporter based on a default
template. Use its properties to specify the lookup table block on which to report and specify report
options.
rptr = LookupTable(lutobj) creates a LookupTable block reporter for the lookup table block
specified by lutobj. By default, the reporter generates a table and a plot of output values versus
breakpoints, and a data types table.
Input Arguments
Properties
Object — Lookup table block
path | handle
Lookup table block to report on, specified as the path or handle of the block.
7-65
7 Classes
Note If you use a finder to find a Lookup Table block and add it directly to a report, this
LookupTable reporter is used rather than a Simulink object property reporter.
Whether to include a table of lookup table data, specified as a logical. If true, the report includes a
table that lists output values and breakpoints of the lookup table.
For a 1-D lookup table, the data table lists the breakpoints in the first column of the table. The second
column lists the corresponding output values.
For a 2-D or greater dimension lookup table, the data table lists the first set of breakpoints in the first
row of the table. It lists the second set of breakpoints in the first column. The output appears in the
corresponding table cells. For lookup tables greater than 2-D, the LookupTable report generator
shows slices of the table as separate output versus breakpoint tables.
Whether to include a lookup table data plot, specified as a logical. If true, the report includes a plot
of the output values versus the breakpoints of the lookup table block.
For a 1-D lookup table, the plot is a line plot of output values versus breakpoints.
For 2-D tables and slices, the plot is a surface or mesh plot of output values versus breakpoints. Use
the PlotType property to specify whether to use a surface or mesh plot.
Plot type for a 2-D lookup table data plot, specified as either a character array ('Surface Plot' or
'Mesh Plot') or string ("Surface Plot" or "Mesh Plot").
Lookup table data reporter, specified as a BaseTable reporter or custom reporter. The
LookupTable reporter uses the specified reporter to create a table of lookup table data.
To customize the appearance of the table of lookup table data, customize the default BaseTable
reporter or replace it with a custom version of the BaseTable reporter.
To customize the title of the table of lookup table data, specify the contents in the Title property of
the default or replacement reporter. The content you specify is placed at the front of the default title.
If the lookup table is too wide to fit legibly on a page, use the MaxCols property of the
DataReporter to generate the table as a set of slices that fit legibly. To determine an optimal value,
iterate setting the MaxCols value and viewing the report .
Example: lutable.DataReporter.Title = 'New Title'
7-66
slreportgen.report.LookupTable class
Lookup table data plot reporter, specified as a Figure reporter or custom reporter. The
LookupTable reporter uses the specified reporter to create a plot of output values versus
breakpoints of the lookup table.
To customize the appearance of the plot of the lookup table data, customize the default Figure
reporter or replace it with a custom version of the Figure reporter. To customize the caption of the
plot, specify the contents in the Caption property of the default or replacement reporter. The
content you specify is placed at the front of the default caption.
Maximum number of table columns to display for the output values versus breakpoints, specified as
inf or an integer. This property applies only if the IncludeTable property is true.
If the number of lookup table columns is greater than the value of this property, the data is shown
only as a surface plot. The plot appears only if the IncludePlot property is true.
The default value of this property is inf, which causes the reporter to use a table regardless of the
size of the lookup table data array. Depending on the size of the data being displayed, some tables
can be illegible. To avoid creation of illegible tables, change the default setting of this property to a
smaller value.
Source of the template for this reporter, specified in one of these ways:
• Character vector or string scalar that specifies the path of the file that contains the template for
this reporter
• Reporter or report whose template is used for this reporter or whose template library contains the
template for this reporter
• DOM document or document part whose template is used for this reporter or whose template
library contains the template for this reporter
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
7-67
7 Classes
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
createTemplate Create Simulink lookup table block reporter template
customizeReporter Create custom LookupTable reporter class
getClassFolder Lookup Table reporter class definition file location
Inherited Methods
Examples
Report on Lookup Table Block
Create a PDF report generator that reports on a lookup table block. This example uses the
slrgex_sf_car model and reports on its engine torque Lookup Table (n-D) block. This block is a
2-D lookup table. The engine torque block is in the Engine subsystem of the slrgex_sf_car
model. The report, by default, includes a table of output values versus breakpoints, a surface plot, a
table of block data types, and notes about possible differences between reported values and values
obtained from simulation.
import slreportgen.report.*
import mlreportgen.report.*
model_name = 'slrgex_sf_car';
load_system(model_name);
lutable = 'slrgex_sf_car/Engine/engine torque';
rpt = slreportgen.report.Report('output','pdf');
chapter = Chapter(lutable);
rptr = LookupTable(lutable);
add(chapter,rptr);
add(rpt,chapter);
close(rpt);
close_system(model_name);
rptview(rpt)
7-68
slreportgen.report.LookupTable class
7-69
7 Classes
Create a PDF report generator that specifies the plot height and width returned by the LookupTable
reporter. This example uses the slrgex_sf_car model and reports on its Torque ratio Lookup
7-70
slreportgen.report.LookupTable class
Table (n-D) block. This block is a 1-D lookup table and is in the transmission/Torque Converter
subsystem of the slrgex_sf_car model. To set the height and width of the plot, use the
PlotReporter property.
import slreportgen.report.*
import mlreportgen.report.*
model_name = 'slrgex_sf_car';
load_system(model_name);
lutable = 'slrgex_sf_car/transmission/Torque Converter/Torque ratio';
rpt = slreportgen.report.Report('output','pdf');
chapter = Chapter(lutable);
rptr = LookupTable(lutable);
rptr.IncludeTable = false;
add(chapter,rptr);
rptr_resized = LookupTable(lutable);
rptr_resized.IncludeTable = false;
rptr_resized.PlotReporter.Snapshot.Width = '3in';
rptr_resized.PlotReporter.Snapshot.Height = '4in';
add(chapter,rptr_resized);
add(rpt,chapter);
close(rpt) ;
close_system(model_name)
rptview(rpt);
The default plot on the first page of the report uses predefined sizing to fit the plot to the page size.
The resized plot on the second page of the report uses the specified 3" width and 4" height.
7-71
7 Classes
Create a PDF report generator that finds all blocks in the Engine subsystem of the slrgex_sf_car
model. The report generator program then loops through the blocks and tests whether the block is a
lookup table block. For lookup table blocks, it uses the LookupTable reporter to report information
about the block. For other blocks, the generated report reports on block properties, which are the
results of the BlockFinder class.
import slreportgen.report.*
import slreportgen.finder.*
model_name = 'slrgex_sf_car';
load_system(model_name)
subsys_name = 'slrgex_sf_car/Engine';
rpt = slreportgen.report.Report;
blkfinder = BlockFinder(subsys_name);
blks = find(blkfinder);
for i=1:length(blks)
if slreportgen.utils.isLookupTable(blks(i).Object)
rptr = LookupTable(blks(i).Object);
ch = Chapter(blks(i).Name);
add(ch,rptr);
add(rpt,ch);
else
ch = Chapter(blks(i).Name);
add(ch,blks(i));
add(rpt,ch);
end
end
close(rpt);
close_system(model_name);
rptview(rpt);
7-72
slreportgen.report.LookupTable class
The first chapter shows the default properties reported for Inport block.
The fifth chapter shows the default output for a Lookup Table block reporter. The default output is a
table of output values versus breakpoints table, a plot, and a table of data types.
7-73
7 Classes
7-74
slreportgen.report.LookupTable class
This example shows how to add fixed content to a customized HTML LookupTable reporter
template. You can also customize your lookup table report output by editing the report generator
program directly. The advantage of customizing a template is that you can reuse it as a basis for
customizing another report generator program.
The template and style sheets for the LookupTable reporter are located in the matlab\toolbox
\shared\slreportgen\rpt\rpt\+slreportgen\+report\@LookupTable\resources
\templates folder. You do not need to specify this path when you copy the default template.
1 Create a copy of the default html template. In this example, the template package is saved as a
zipped file named CustomTemplate.htmtx in the current working folder.
import mlreportgen.report.*
import slreportgen.report.*
LookupTable.createTemplate('CustomTemplate','html');
2 Unzip the template package.
unzipTemplate('CustomTemplate.htmtx');
The unzipped template package is a folder of document, style sheet, and image files. In this
example, the unzipped folder of files is named "CustomTemplate" and is saved in the current
working folder. The root.css file, which is in the stylesheets subfolder, defines the styles that
control the appearance and formatting of the generated report. The docpart_templates.html
file specifies the holes that hold the report contents when the report is generated.
3 From the CustomTemplate folder, open the docpart_templates.html file in a text editor
outside of MATLAB.
<html>
<head>
7-75
7 Classes
<dptemplate name="LookupTable">
<hole id="Content">LUT_CONTENT</hole>
<p><scan>This lookup table block contains the following
data types:</scan></p>
<hole id="LUTDataTypes">DATA_TYPE</hole>
<hole id="FootNoteContent">LUT_FOOTNOTE_CONTENT</hole>
</dptemplate>
5 Save the file.
6 At the MATLAB command line, zip the template folder into a template package. For this example,
the template package is zipped to the CustomTemplate.htmtx file.
zipTemplate('CustomTemplate');
7 To use the saved template for your report, specify the template source in your report generator
program.
lutable = LookupTable();
lutable.TemplateSrc = 'CustomTemplate';
See Also
slreportgen.finder.BlockFinder | slreportgen.finder.BlockResult |
slreportgen.finder.DiagramElementFinder |
slreportgen.finder.DiagramElementResult | mlreportgen.report.BaseTable |
mlreportgen.report.Figure | slreportgen.utils.isLookupTable
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
“Templates”
7-76
slreportgen.report.LookupTable class
Introduced in R2018a
7-77
7 Classes
slreportgen.report.MATLABFunction class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Use an object of the slreportgen.report.MATLABFunction class to report on a Simulink
MATLAB Function block or Stateflow MATLAB function.
Use the reporter properties to include other information, such as detailed argument properties,
function symbol properties, and supporting functions.
Note To use a MATLABFunction reporter in a report, you must create the report using the
slreportgen.report.Report class.
Class Attributes
HandleCompatible true
Creation
Description
7-78
slreportgen.report.MATLABFunction class
Properties
Object — MATLAB function block or Stateflow MATLAB function
[] (default) | character vector | string scalar | function handle
MATLAB function block or Stateflow MATLAB function to report, specified as one of these values:
Note If you use a finder to find a MATLAB Function block or Stateflow MATLAB function and add the
result directly to a report, an slreportgen.report.MATLABFunction reporter is used instead of a
Simulink object property reporter.
Whether to include object properties, specified as a true or false. If the value is true, the report
includes a table of the properties of the Simulink or Stateflow object that corresponds to the MATLAB
Function block or Stateflow MATLAB function being reported.
To customize the appearance of the function property table and its title, customize the default
BaseTable reporter or replace it with a custom version of the BaseTable reporter. To customize the
title of the function property table, specify the contents in the Title property of the default or
replacement reporter. The content you specify is placed at the front of the default title.
Whether to include an argument summary table, specified as true or false. If the value is true, the
report includes a summary table of the properties of the arguments of the reported function.
Argument properties to include in the argument summary table, specified as a cell array of character
vectors or a string array. If the model is not already compiled, the MATLABFunction reporter
compiles the model to obtain Compile Type and Compiled Size data. When the report is closed,
the model is uncompiled.
7-79
7 Classes
To customize the appearance of the argument summary table and the content of its title, customize
the default BaseTable object or replace it with a custom version of the BaseTable object.
Whether to include a property table with detailed information for each argument, specified as true
or false. If the value is true, the report includes a property table for each argument of the MATLAB
function. If the model is not already compiled, the MATLABFunction reporter compiles the model.
When the report is closed, the model is uncompiled.
To customize the appearance of the argument property table, customize the default BaseTable
reporter or replace it with a custom BaseTable reporter.
Whether to include the script of the MATLAB function, specified as a true or false. If the value is
true, the report includes the code that computes the output of the MATLAB function from its inputs.
To customize the code appearance, modify the properties of the default Paragraph reporter or
replace the reporter with a custom reporter. If you add content to the default or replacement
Paragraph reporter, the content is placed before the MATLAB Function script in the generated
report.
7-80
slreportgen.report.MATLABFunction class
Function block named Covariance Derivative, the title is Covariance Derivative Function
Script. The properties of the paragraph specify the appearance of the title.
To customize the title appearance, modify the properties of the default Paragraph object or replace
it with another paragraph object. If you add content to the default or replacement title paragraph, the
content you specify is placed at the front of the default title.
Whether to highlight script syntax keywords, specified as true or false. If the value is true, the
report uses color to highlight the function code syntax keywords.
If the value is true, the report includes information about the symbols that appear in the main
MATLAB function code. If the IncludeSupportingFunctions property is true, the report also
contains information about symbols that appear in the code of the supporting functions. Function
symbol data is reported only if the Object property of specifies a MATLAB Function block.
Note If you include function symbol data, report generation can be slower than if you do not include
it.
7-81
7 Classes
To customize the appearance of the function symbol data tables, customize the default BaseTable
reporter or replace it with a custom BaseTable reporter. If you specify the Title property in the
default or replacement BaseTable reporter, the content is placed at the front of the default title in
the generated report.
If the value is true, the report includes a list of the user-defined functions called directly or
indirectly by the main function of the MATLAB Function block being reported.
Supporting function types to be reported, specified as a cell array of character vectors or a string
array. The cell array or string array can specify one or both of these types.
To customize the appearance of the supporting functions table, customize the default BaseTable
reporter or replace it with a customized version of the BaseTable reporter.
7-82
slreportgen.report.MATLABFunction class
Whether to include the code of user-defined supporting functions, specified as true or false. If the
value is true, the report includes the code for the user-defined functions called directly or indirectly
by the main function.
To customize the code appearance, modify the properties of the default Paragraph reporter or
replace the reporter with a custom reporter. If you add content to the default or replacement
Paragraph reporter, the content is placed before the supporting function code in the generated
report.
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
7-83
7 Classes
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
slreportgen.report.MATLABFunction.createTemplate Create copy of
slreportgen.report.MATLABFunction
reporter template
slreportgen.report.MATLABFunction.getClassFolder Get location of folder that contains
slreportgen.report.MATLABFunction class
definition file
slreportgen.report.MATLABFunction.customizeReporter Create subclass of
slreportgen.report.MATLABFunction class
copy Create copy of a Simulink reporter object
and make deep copies of certain property
values
getImpl Get implementation of reporter
Examples
import slreportgen.report.*
import mlreportgen.report.*
model_name = "slrgex_radar_eml";
load_system(model_name);
mlfcnObj = "slrgex_radar_eml/MATLAB Function";
rpt = slreportgen.report.Report("MyReport","pdf");
chapter = Chapter(mlfcnObj);
rptr = MATLABFunction(mlfcnObj);
add(chapter,rptr);
add(rpt,chapter);
close(rpt);
close_system(model_name);
rptview(rpt);
7-84
slreportgen.report.MATLABFunction class
import slreportgen.report.*
import mlreportgen.report.*
7-85
7 Classes
model_name = "slrgex_radar_eml";
load_system(model_name);
mlfcnObj = "slrgex_radar_eml/MATLAB Function";
rpt = slreportgen.report.Report("myReport","pdf");
chapter = Chapter(mlfcnObj);
rptr = MATLABFunction(mlfcnObj);
rptr.IncludeArgumentProperties = true;
add(chapter,rptr);
add(rpt,chapter);
close(rpt);
close_system(model_name);
rptview(rpt);
Here are some of the argument detail tables in the generated report:
7-86
slreportgen.report.MATLABFunction class
To customize the title of the function script section, use the FunctionScriptTitle property. To
change the formatting of the code, create a DOM paragraph that specifies the font family, size, and
color and assign the paragraph to the FunctionScript property.
import slreportgen.report.*
import mlreportgen.report.*
model_name = "slrgex_radar_eml";
load_system(model_name);
mlfcnObj = "slrgex_radar_eml/MATLAB Function";
rpt = slreportgen.report.Report("myReport","html");
chapter = Chapter(mlfcnObj);
rptr = MATLABFunction(mlfcnObj);
paraScript = mlreportgen.dom.Paragraph;
paraScript.FontFamilyName = "Arial";
paraScript.FontSize = "12pt";
paraScript.Color = "blue";
rptr.FunctionScript = paraScript;
add(chapter,rptr);
add(rpt,chapter);
close(rpt);
close_system(model_name);
rptview(rpt);
Here is a portion of the function script section, which shows the title and some of the code:
7-87
7 Classes
By default, a MATLABFunction reporter includes the code of the main function, but not the code of
the user-defined supporting functions that the main function calls. To include the code of the user-
defined functions, use the IncludeSupportingFunctionsCode property.
import slreportgen.report.*
import mlreportgen.report.*
model_name = "slrgex_stats";
load_system(model_name);
mlfcnObj = "slrgex_stats/MATLAB Function";
rpt = slreportgen.report.Report("myReport","pdf");
chapter = Chapter(mlfcnObj);
rptr = MATLABFunction(mlfcnObj);
rptr.IncludeSupportingFunctionsCode = true;
add(chapter,rptr);
add(rpt,chapter);
close(rpt);
close_system(model_name);
rptview(rpt);
Here is the MATLAB function script section, which shows the code for both the main function and the
user-defined supporting function, avg.
7-88
slreportgen.report.MATLABFunction class
See Also
slreportgen.finder.BlockFinder | slreportgen.finder.BlockResult |
slreportgen.finder.DiagramElementFinder |
slreportgen.finder.DiagramElementResult |
slreportgen.finder.StateflowDiagramElementFinder | mlreportgen.report.BaseTable
| mlreportgen.dom.Paragraph | MATLAB Function | slreportgen.utils.isMATLABFunction
Topics
“Report on MATLAB Function” on page 4-13
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2018a
7-89
7 Classes
slreportgen.report.ModelConfiguration class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Use an object of the slreportgen.report.ModelConfiguration class to report on the active
configuration set of a model.
Class Attributes
HandleCompatible true
Creation
Description
Properties
Model — Name or handle of model
[] (default) | string scalar | character vector | handle
Name or handle of open or loaded Simulink model, specified as a string scalar, character vector, or
handle.
7-90
slreportgen.report.ModelConfiguration class
Configuration set title, specified as a character vector, string scalar, mlreportgen.dom.Text object,
mlreportgen.dom.InternalLink object, or mlreportgen.dom.ExternalLink object.
If the FormatPolicy property is set to "Inline Text" and the Title property is set to:
In both cases, to format the title, use the TextFormatter property of this ModelConfiguration
reporter.
If you do not specify a title, the title is the model name followed by Configuration Set. For
example:
Format for reporting the configuration set, specified as one of these strings or character vectors:
Table formatter for the tables that the ModelConfiguration reporter generates, specified as an
mlreportgen.report.BaseTable object. The default value of this property is a BaseTable object
with the TableStyleName property set to the ModelConfigurationTable style, which is defined
in the default template for a ModelConfiguration reporter. To customize the appearance of the
table, modify the properties of the default BaseTable object or replace the object with your own
BaseTable object. If you add content to the Title property, the content appears in front of the table
title in the generated report.
Paragraph formatter for any model configuration content that is generated as a paragraph, specified
as an mlreportgen.dom.Paragraph object. The default value of this property is a Paragraph
object with the StyleName property set to the ModelConfigurationParagraph style, which is
defined in the default template for a ModelConfiguration reporter. To customize the appearance of
the paragraph, modify the properties of the default Paragraph object or replace the object with your
own Paragraph object. If you add content to the paragraph object, the content appears in front of
the model configuration content in the generated report.
Text formatter for any model configuration content that is generated as inline text, specified as an
mlreportgen.dom.Text object. By default, the value of this property is an empty Text object. To
customize the appearance of the text, modify the properties of the default mlreportgen.dom.Text
object or replace the object with a customized mlreportgen.dom.Text object. If you add content to
the Text object, the content appears in front of the model configuration content in the generated
report.
7-91
7 Classes
Maximum number of table columns in value tables, specified as a positive integer. If a property value
is reported using a table and the number of columns is greater than the value of the MaxCols
property, the table is sliced vertically. Slicing divides the table into multiple tables.
Maximum number of nested levels in the structured object hierarchy to report, specified as a
nonnegative integer. The top level of the hierarchy is the configuration set object
(Simulink.ConfigSet). Levels less than or equal to the value of DepthLimit are flattened into a
sequence of interlinked tables. Levels greater than the depth limit are not reported. If you set the
DepthLimit property to 0, hierarchically structured types are not expanded.
When IncludeTitle is true, the configuration set title (the content of the Title property) is
included in the:
The configuration set title is always included in the title for the paragraph or table that contains the
configuration set components, regardless of the value of the IncludeTitle property.
Whether a title includes the data type of the value that the title describes, specified as true or
false.
Data Types: logical
Whether to show configuration set or component properties that have empty values, specified as a
true or false.
Data Types: logical
Whether to show configuration set or component properties that use the default values, specified as
true or false.
Data Types: logical
7-92
slreportgen.report.ModelConfiguration class
Function or expression to filter configuration set and component object properties from a report,
specified as a function handle, string scalar, or character vector. Specify a function as a function
handle. Specify an expression as a string scalar or character vector. If PropertyFilterFcn is
empty, all properties are included in the report.
For example, this code uses the PropertyFilterFcn property to prevent the display of the Name
and Description properties:
import slreportgen.report.*
rpt = slreportgen.report.Report("MyReport","pdf");
open(rpt);
model = "slrgex_sf_car";
load_system(model);
reporter = ModelConfiguration(model);
reporter.PropertyFilterFcn = filterFcnHandle;
append(rpt,reporter);
close(rpt);
rptview(rpt);
If you provide a string scalar or a character vector, it must contain an expression. The expression:
For example, this code uses the PropertyFilterFcn property to prevent the display of the Name
and Description properties:
import slreportgen.report.*
rpt = slreportgen.report.Report("MyReport","pdf");
open(rpt);
model = "slrgex_sf_car";
load_system(model);
reporter = ModelConfiguration(model);
append(rpt,reporter);
close(rpt);
rptview(rpt);
7-93
7 Classes
Format or precision used to display noninteger numeric values, specified as a string scalar, character
vector, or positive integer.
Specify the format as a string scalar or a character vector. See the formatSpec argument on the
sprintf reference page.
Specify the precision as a positive integer. See the precision argument on the num2str reference
page.
Example: "%.2f" displays double values with two digits to the right of the decimal place.
Example: 2 displays a maximum number of two significant digits.
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
slreportgen.report.ModelConfiguration.createTemplate Create model configuration reporter
template
slreportgen.report.ModelConfiguration.customizeReporter Create custom model configuration
reporter class
slreportgen.report.ModelConfiguration.getClassFolder Get location of model configuration
reporter class definition file
copy Create copy of a Simulink reporter
object and make deep copies of certain
property values
getConfigSet Get active configuration set from model
configuration reporter
getImpl Get implementation of reporter
7-94
slreportgen.report.ModelConfiguration class
Examples
Import the MATLAB Report and Simulink Report API packages so that you do not have to use long,
fully qualified class names.
import mlreportgen.report.*
import slreportgen.report.*
rpt = slreportgen.report.Report("MyReport","pdf");
open(rpt);
chapter = Chapter();
chapter.Title = "Active Model Configuration Set";
Load a model.
model = "slrgex_sf_car";
load_system(model);
reporter = ModelConfiguration(model);
append(chapter,reporter);
append(rpt,chapter);
close(rpt);
rptview(rpt);
See Also
Simulink.ConfigSet
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
“Manage Configuration Sets for a Model”
Introduced in R2020b
7-95
7 Classes
slreportgen.report.ModelVariable class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Reporter for a Simulink model variable.
Class Attributes
HandleCompatible true
Creation
Description
You can customize the reporting of a model variable by setting the properties of the
slreportgen.report.ModelVariable object.
Properties
Variable — Simulink.VariableUsage object
Simulink.VariableUsage
The Simulink.VariableUsage object that corresponds to the variable to report on. The object
contains the name of the variable, the source of the variable, and the blocks that use the variable.
This property is read-only.
7-96
slreportgen.report.ModelVariable class
Path of the Model block that sets the variable value, specified as a character vector.
Suppose that a referenced model uses a model argument to set a block parameter value. If a model
has multiple instances of the referenced model, the model variable finder returns multiple instances
of the variable that is associated with the model argument. The ModelBlockPath property uniquely
identifies the instance of the variable by providing the path to the model block that set its value. If a
variable is not associated with a model argument in a referenced model, the ModelBockPath is
empty. For more information about referenced models and instance-specific parameters, see
“Parameterize Instances of a Reusable Referenced Model”.
Whether to include a list of blocks that use this variable, specified as true or false. If the
FormatPolicy property has a value of "Inline Text", the list of blocks is not included in the
report, regardless of the value of the ShowUsedBy property.
If the report includes reported content for a block in the Used By list, clicking the hyperlink for the
block takes you to the content. See “Generate Report of Model Variables, Diagrams, and Blocks” on
page 7-102.
Whether to include the workspace that the variable is resolved in, specified as true or false. If the
FormatPolicy property has a value of "Inline Text", the workspace is not included in the report,
regardless of the value of the ShowWorkspaceInfo property.
List formatter that formats the list of blocks that use the variable, specified as an
mlreportgen.dom.UnorderedList object or an mlreportgen.dom.OrderedList object. To
customize how the list is formatted, modify the list object properties or replace the list object with a
customized list object that does not contain list items.
Format of the variable values, specified as one of these strings or character vectors:
7-97
7 Classes
Text formatter to format the name and value of the model variable when the text is in line with the
surrounding text, specified as an mlreportgen.dom.Text object. To customize the appearance of
the text, modify the properties of the default mlreportgen.dom.Text object or replace the object
with a customized mlreportgen.dom.Text object. If you add content to the default or replacement
text object, the content appears in front of the variable content in the generated report.
Maximum number of table columns to display, specified as a positive integer. For array variables
reported using a table, if the number of columns is greater than the value of the MaxCols property,
the table is sliced vertically. Slicing divides the table into multiple tables.
Maximum number of levels to report for a variable that is a structured object or an array of
structured objects, specified as a nonnegative integer. Levels less than or equal to the value of
DepthLimit are flattened into a sequence of interlinked tables (see the FormatPolicy property).
Levels greater than the depth limit are not reported. If you set the DepthLimit property to 0,
structured objects are not expanded.
Whether to include a title, specified as true or false. The title contains the variable name and
optionally, the data type. If IncludeTitle is true, the title is included. By default, the title includes
only the name of the variable. To include the data type of the variable, set the ShowDataType
property to true.
If the FormatPolicy property is set to "Inline Text" and the Title property is set to:
In both cases, to format the title, use the TextFormatter property of this ModelVariable reporter.
If you do not specify the Title property, the title is the variable name.
7-98
slreportgen.report.ModelVariable class
Whether to show the data type of the variable in the title, specified as true or false.
Whether to show properties that have empty values, specified as a true or false. The
ShowEmptyValues property applies only to MATLAB object, Simulink object, and Stateflow object
variables.
Whether to show properties that use the default value, specified as true or false. The
ShowDefaultValues property applies only to MATLAB object, Simulink object, and Stateflow object
variables.
Function or expression to filter the properties of a reported model variable from a report. Specify a
function as a function handle. Specify an expression as a string scalar or character vector. This
property applies only to a variable that contains an object. If you do not provide
PropertyFilterFcn, all properties of the model variable are included in the report.
For example, this code prevents the display of the Description and Complexity properties of a
Simulink.Parameter object.
import slreportgen.finder.*
import slreportgen.report.*
rpt = slreportgen.report.Report('modelvarrpt','pdf');
model_name = load_system('sldemo_mdlref_datamngt');
finder = slreportgen.finder.ModelVariableFinder(model_name);
while hasNext(finder)
result = next(finder);
varRptr = getReporter(result);
varRptr.PropertyFilterFcn = @varPropertyFilter;
add(rpt,varRptr);
end
close(rpt);
close_system(model_name);
rptview(rpt);
7-99
7 Classes
end
end
If you provide a string scalar or a character vector, it must contain an expression. The expression:
For example, this code filters the CoderInfo property of a Simulink.Parameter object from the
report.
import slreportgen.finder.*
import slreportgen.report.*
rpt = slreportgen.report.Report('modelvarrpt','pdf');
model_name = load_system('sldemo_mdlref_datamngt');
finder = slreportgen.finder.ModelVariableFinder(model_name);
while hasNext(finder)
result = next(finder);
varRptr = getReporter(result);
close(rpt);
close_system(model_name);
rptview(rpt);
Specify the format as a string scalar or a character vector. See the formatSpec argument on the
sprintf reference page.
Specify the precision as a positive integer. See the precision argument on the num2str reference
page.
Example: "%.2f" displays double values with two digits to the right of the decimal place.
Example: 2 displays a maximum number of two significant digits.
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
7-100
slreportgen.report.ModelVariable class
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
getVariableName Get name of variable from model variable
reporter
getVariableValue Get value of variable from model variable
reporter
slreportgen.report.ModelVariable.createTemplate Create model variable reporter template
slreportgen.report.ModelVariable.customizeReporter Create custom model variable reporter class
slreportgen.report.ModelVariable.getClassFolder Get location of model variable reporter class
definition file
copy Create copy of a Simulink reporter object and
make deep copies of certain property values
getImpl Get implementation of reporter
Examples
% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");
% Create a Chapter
chapter = mlreportgen.report.Chapter();
chapter.Title = "Model Variable Reporter Example";
while hasNext(finder)
result = next(finder);
7-101
7 Classes
Each block name in the Used By list for a model variable is a hyperlink to the corresponding content
reported for the block.
% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");
7-102
slreportgen.report.ModelVariable class
blFinder = slreportgen.finder.BlockFinder(result.Object);
while hasNext(blFinder)
blockresult = next(blFinder);
add(sect,blockresult);
end
add(ch,sect);
add(rpt, ch);
end
See Also
slreportgen.report.BusObject | Simulink.VariableUsage |
slreportgen.finder.ModelVariableResult | slreportgen.finder.ModelVariableFinder
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
7-103
7 Classes
slreportgen.report.Notes class
Package: slreportgen.report slreportgen.report slreportgen.report
slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Create a reporter that reports on Simulink or Stateflow diagram notes.
Note To use a Notes reporter in a report, you must create the report using the
slreportgen.report.Report class.
Class Attributes
HandleCompatible true
Creation
Description
Properties
Source — Source from which to extract notes
[] (default) | string scalar | character vector | handle | slreportgen.finder.DiagramResult
object
Source from which to extract notes, specified as a string scalar, character vector, handle, or
slreportgen.finder.DiagramResult object. The source can be a model, subsystem, Stateflow
chart, Stateflow truth table, or Stateflow state transition table.
7-104
slreportgen.report.Notes class
Value Description
'Internal' Note content is included with the model and is
saved in a .mldatx file.
'External' Note content is external to the model and is
specified by a URL.
'Inherited' Note content originates from the ancestors of the
specified diagram source.
'None' The diagram does not have notes.
Whether to report on notes that have a NoteType of 'Inherit', specified as true or false. The
reported note content is based on the parent note type as described in this table.
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
7-105
7 Classes
Methods
Public Methods
Examples
This example reports the notes for the slreportgendemo_autotrans model. This example reports
the notes for the overall model. For an example that reports the diagram and notes for each
subsystem of the model, see “Report Model Notes” on page 4-39.
The example creates a chapter for the notes and includes the model notes in the chapter by adding an
slreportgen.report.Notes reporter to the chapter.
model = "slreportgendemo_autotrans";
open_system(model);
7-106
slreportgen.report.Notes class
import mlreportgen.report.*
import slreportgen.report.*
close(rpt);
rptview(rpt);
See Also
slreportgen.finder.DiagramResult | slreportgen.finder.SystemDiagramFinder |
slreportgen.finder.ChartDiagramFinder
Topics
“Report Model Notes” on page 4-39
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2020a
7-107
7 Classes
slreportgen.report.Report class
Package: slreportgen.report
Report container
Description
slreportgen.report.Report is a container for a report based on Simulink reporters and DOM
objects. Use this object to generate an HTML, PDF, or Word report based on templates in a template
library.
Construction
report = slreportgen.report.Report() returns a report object report with the default report
type (PDF) and a default file name (untitled.pdf).
report = slreportgen.report.Report(path) uses the specified output path for the report.
Input Arguments
7-108
slreportgen.report.Report class
Properties
OutputPath — Report document output path
string | character array
Report document output path, specified as a string or character array. The path is the location in the
file system where the report output document is stored. The path can be a full path or a path relative
to the current MATLAB folder, for example, 'C:/myreports/reportA.docx' or 'reportA'. If the
file name does not have a file extension corresponding to the Type property, the appropriate file
extension is added.
Note Generating a PDF report on a cloud drive, such as MATLAB Drive™, can result in an error that
is caused by file contention between the report generation software and the cloud drive
synchronization software. To avoid this error, generate reports on a local drive that does not
synchronize with the cloud. Consider writing a script that generates a report on a local drive and
then copies the report to the cloud drive.
• 'HTML' — HTML report packaged as a zipped file containing the HTML file, images, style sheet,
and JavaScript files of the report.
• 'HTML-FILE' — HTML report as a single HTML file containing the text, style sheet, JavaScript,
and base64-encoded images of the report
• 'PDF' — PDF file
• 'DOCX' — Microsoft Word document
If you specify a template using the TemplatePath property, the value for Type must match the
template type.
Page layout options for this report, specified as a report layout object. See
mlreportgen.report.ReportLayout.
Locale or language, specified as the ISO 639-1 two-letter language code of the locale for which this
report is to be generated. The default [] specifies the language of the system locale, for example,
English on an English system. The Report API uses the language code to translate chapter title
prefixes to the language of the specified locale. Translations are provided for the following locales:
af, ca, cs, da, de, el, en, es, et, eu, fi, fr, hu, id, it, ja, ko, nl, nn, no, pl, pt, ro, ru, sk, sl,
sr, sv, tr, uk, xh, and zh. If you specify an unsupported locale, the English version is used. See ISO
639-1 codes.
7-109
7 Classes
Location of template used to format the report, specified as a string or character array. Use this
property to specify a custom template for this report.
This read-only property is a containers.Map object that contains information for generating the
report, such as the hierarchical level of the current report section.
Debug mode, specified as a logical. If you set Debug to true, the temporary files for the report are
stored in a subfolder of the report folder. In debug mode, these files are not deleted when the report
is closed.
Whether to compile the Simulink model before reporting, specified as a logical. If this property is
true and the model is not already compiled, it compiles when you add a reporter that reports on that
model to this report. If the model cannot be compiled, report generation terminates. If this property
is false, report generation proceeds without compiling the model.
Methods
This class uses the same methods as the MATLAB version. Instead of using mlreportgen in the class
name, use slreportgen. See mlreportgen.report.Report for a list of methods.
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Compatibility Considerations
add method is not recommended
Starting in R2020b, use the append method instead of the add method to add content to objects of
these Report API classes:
• slreportgen.report.Report
• mlreportgen.report.Chapter
• mlreportgen.report.Section
7-110
slreportgen.report.Report class
There are no plans to remove the add methods of the Report, Chapter, or Section classes. Report
API programs that use the add methods will continue to run.
To update existing code, replace the method name add with append as shown by the examples in the
table.
close(rpt); close(rpt);
rptview(rpt); rptview(rpt);
See Also
slreportgen.finder.DiagramFinder | slreportgen.finder.DiagramElementFinder |
slreportgen.finder.SystemDiagramFinder | slreportgen.finder.ChartDiagramFinder |
slreportgen.finder.StateflowDiagramElementFinder |
slreportgen.finder.StateFinder | slreportgen.report.StateflowObjectProperties |
slreportgen.report.SimulinkObjectProperties | slreportgen.report.Diagram |
slreportgen.finder.BlockFinder | slreportgen.finder.AnnotationFinder
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-111
7 Classes
slreportgen.report.Reporter class
Package: slreportgen.report
Description
The slreportgen.report.Reporter class is a superclass for the Simulink Report API reporters
and custom reporters that you create to report on Simulink models and model elements. The format
of a reporter is based on a template.
Note To use a subclass of slreportgen.report.Reporter in a report, you must create the report
using the slreportgen.report.Report class or subclass.
Class Attributes
HandleCompatible true
Creation
Description
Properties
TemplateSrc — Source of template for this reporter
[] (default) | character vector | string scalar | reporter or report | DOM document or document part
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
7-112
slreportgen.report.Reporter class
Attributes:
GetAccess public
SetAccess public
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template specified by the TemplateSrc
property of this reporter.
Attributes:
GetAccess public
SetAccess public
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Attributes:
GetAccess public
SetAccess public
Methods
Public Methods
copy Create copy of a Simulink reporter object and make
deep copies of certain property values
getImpl Get implementation of reporter
slreportgen.report.Reporter.createTemplate Create reporter template
slreportgen.report.Reporter.customizeReporter Create class derived from
slreportgen.report.Reporter class
slreportgen.report.Reporter.getClassFolder Get location of folder containing
slreportgen.report.Reporter class definition file
See Also
slreportgen.report.Report
Topics
“What Is a Reporter?”
“Report Generation for Simulink and Stateflow Elements” on page 1-9
Introduced in R2021a
7-113
7 Classes
slreportgen.report.RptFile class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Use the RptFile reporter to include the content generated by a Report Explorer setup (.rpt) file in
a Report API report. When added to a report, the RptFile reporter:
1 Executes the specified Report Explorer setup file to generate a DocBook XML rendition of the
Report Explorer report
2 Uses a modified version of the Report Explorer Docbook-to-DOM conversion template to convert
the XML to a set of DOM objects (see “Manage Report Conversion Templates”)
3 Adds the DOM content to the Report API report.
Note Use a Block Loop rather than a Chart Loop component in your report setup file to report on
Stateflow charts. See “Report on Stateflow Dialog Snapshots” on page 7-119.
Creation
Description
reporter = RptFile() creates an empty Report Explorer-based RptFile reporter. Before adding
the reporter to a report, your report program must set the reporter's SetupFile property to the path
of a Report Explorer setup (.rpt) file. Otherwise, an error occurs.
By default, the RptFile reporter uses a conversion template that is a slightly modified version of the
Report Explorer's default conversion template for the report output type. For example, if the report
output type is PDF, the reporter uses a slightly modified version of the default template for the Report
Explorer's PDF (from template) output type.
You can use a custom conversion template to customize the reporter output. Use the reporter's
createTemplate method to create a copy of one of the reporter's default output-type-specific
conversion templates for customization. To use the customized template, set the RptFile reporter's
TemplateSrc property to the path of the customized template.
reporter = RptFile(Name,Value) sets properties using name-value pairs. You can specify
multiple name-value pair arguments in any order. Enclose each property name in single quotes.
7-114
slreportgen.report.RptFile class
Properties
SetupFile — Report Explorer setup file path
character array | string
Report Explorer setup file path, specified as a character array or string. Do not use form-based
reports for setup files that you use with the RptFile reporter. The Report API report to which the
setup file is added overrides the output type of the setup file.
Attributes:
GetAccess public
SetAccess public
Model name, specified as a character array or string, of the model for which the specified SetupFile
is executed. If the setup file contains a Model Loop, the RptFile reporter sets its value to the value
of this property. An error occurs if the setup file does not contain a Model Loop or contains multiple
model loops.
Attributes:
GetAccess public
SetAccess public
GetAccess public
SetAccess public
7-115
7 Classes
property. If the value is a DiagramElementResult object, the reporter uses the value of the object's
DiagramPath and Name properties to determine the full path. An error occurs if the setup file does
not contain a Block Loop or contains multiple block loops.
Note Use a Block Loop component in your setup file to report on Stateflow charts. See “Report on
Stateflow Dialog Snapshots” on page 7-119.
Attributes:
GetAccess public
SetAccess public
Source of conversion template to be used by this reporter to convert the setup file's XML output to
DOM objects. An empty value specifies use of the default template for the output type of the report to
be generated. A string or character array value specifies the path of a customized version of the
default template for the output type to be generated.
Attributes:
GetAccess public
SetAccess public
Name of template for this reporter, specified as a character array or string. By default this property
specifies RptFile, the name of the reporter's default template. This default template resides in the
template library of its default conversion template along with other templates used to convert Report
Explorer XML components to DOM objects. The default reporter template contains a single hole
named Content to be filled with the DOM content converted from the XML content generated by the
setup. If you change the name of this template, you must set this property to the new name. You can
modify the template itself, but the modified template must contain a hole named Content.
Attributes:
GetAccess public
SetAccess public
Hyperlink target for this reporter, specified as a string or character array that specifies the link target
ID, or an mlreportgen.dom.LinkTarget object. A string or character array value is converted to a
LinkTarget object. The link target object immediately precedes the content of this reporter in the
output report.
7-116
slreportgen.report.RptFile class
Attributes:
GetAccess public
SetAccess public
Methods
Public Methods
slreportgen.report.RptFile.createTemplate Create Report Explorer-based (RptFile) reporter
template
slreportgen.report.RptFile.customizeReporter Create custom Report Explorer-based reporter class
slreportgen.report.RptFile.getClassFolder Report Explorer-based reporter class definition file
location
copy Create copy of a Simulink reporter object and make
deep copies of certain property values
getImpl Get implementation of reporter
Examples
Create an RptFile reporter without specifying a setup file. Then, use the SetupFile property to
specify the Report Explorer setup file.
reporter = slreportgen.report.RptFile();
reporter.SetupFile = "my_setup_file.rpt"
Use the RptFile reporter to report on a Documentation block in the slrgex_fuelsys Simulink
model.
The RptFile reporter uses a Report Explorer setup file to obtain information about the
Documentation block.
Note Before you run this example, use the Report Explorer to create a setup file named
my_setup_file.rpt. The setup file for this example contains a hierarchy of a Model Loop, System
Loop, Block Loop, Paragraph, and Documentation components as shown. Select the components from
the middle pane.
• Model Loop, System Loop, and Block Loop components are in the Simulink folder.
• Paragraph component is in the Formatting folder.
• Documentation block component is in the Simulink Blocks folder.
For more information on setting up a setup file for this example, see “Create a Report Setup File”.
7-117
7 Classes
Use this script to generate a report that includes information about the properties of the Sensor Info
Documentation block in the ToController system of the slrgex_fuelsys model.
model = "slrgex_fuelsys";
load_system(model)
rpt = slreportgen.report.Report("MyReport","pdf");
chap = mlreportgen.report.Chapter("Report on a DocBlock");
rptFile = slreportgen.report.RptFile("my_setup_file.rpt");
rptFile.Model = model;
rptFile.System = "sldemo_fuelsys/To Controller";
rptFile.Block = "sldemo_fuelsys/To Controller/Sensor Info";
add(chap,rptFile);
add(rpt,chap);
close(rpt);
rptview(rpt);
7-118
slreportgen.report.RptFile class
Use the Report Explorer to create a setup file named my_setup_file.rpt. The setup file for this
example contains a hierarchy consisting of a Model Loop, System Loop, Block Loop, and Stateflow
Dialog Snapshot component. Select the components from the middle pane.
• The Model Loop, System Loop, and Block Loop components are in the Simulink folder.
• The Stateflow Dialog Snapshot component is in the Stateflow folder.
For more information on setting up a setup file, see “Create a Report Setup File”.
7-119
7 Classes
rpt = slreportgen.report.Report("MyReport","pdf");
open(rpt);
Load a model.
model = "slrgex_sf_car";
load_system(model);
Create a chapter.
chap = mlreportgen.report.Chapter();
chap.Title = strcat(model,": Stateflow Dialog Snapshots");
sys_finder = slreportgen.finder.SystemDiagramFinder(model);
systems = find(sys_finder);
Find all the blocks in the current system. Use the report setup file to report on Stateflow dialog
snapshots.
7-120
slreportgen.report.RptFile class
rptFile.System = system;
rptFile.Block = block;
add(chap,rptFile);
end
end
end
add(rpt,chap);
close(rpt);
rptview(rpt);
See Also
mlreportgen.report.RptFile | slreportgen.report.Report
Topics
“Use Simulink Report Explorer Components in a Report API Report” on page 4-20
“Working with the Report Explorer”
Introduced in R2019a
7-121
7 Classes
slreportgen.report.Signal class
Package: slreportgen.report
Signal reporter
Description
Use an object of the slreportgen.report.Signal class to report the properties of a signal.
Signals are the outputs of dynamic systems that are represented by blocks in a Simulink diagram and
by the diagram itself. See “Signal Basics”.
Note To use a Signal object in a report, you must create the report using the
slreportgen.report.Report class or subclass.
Class Attributes
HandleCompatible true
Creation
Description
Properties
Object — Block output port representing signal to report
[] (default) | handle
Block output port that represents the signal to report, specified as a handle. The signal reporter
reports information about the properties of the output port and the properties of the line connected
to the port.
7-122
slreportgen.report.Signal class
Whether to report information about the Simulink.Signal object for this signal, specified as true
or false. If this property is true, the signal reporter includes information about the
Simulink.Signal object that specifies the attributes of the signal. The properties of the
Simulink.Signal object are reported using an mlreportgen.report.MATLABVariable reporter.
Use the MATLABVariableReporter property of this signal reporter to customize the appearance of
the signal object information. If the signal is not associated with a signal object, nothing is reported.
Reporter for the Simulink.Signal object that defines the signal being reported, specified as an
mlreportgen.report.MATLABVariable object. The default value is an empty MATLABVariable
reporter with the DepthLimit property set to 0. The default reporter reports information about the
Simulink.Signal object in a single table. To customize the appearance of the reported information,
modify the properties of the default MATLABVariable reporter or replace the reporter with a
customized MATLABVariable reporter. For example, the following code uses the
PropertyFilterFcn property of the MATLABVariable reporter to display only specific properties
of the Simulink.Signal object:
Some properties of signal objects, such as the CoderInfo property, have values that are also objects
with properties. To display the properties of properties in separate tables, set the DepthLimit
property of the MATLABVariableReporter to an integer that is greater than 0. For example:
signalRptr.MATLABVariableReporter.DepthLimit = 10;
Whether to show signal properties that have empty values, specified as true or false.
Signal properties to report, specified as a string array or a cell array of character vectors. Specify any
combination of these properties:
7-123
7 Classes
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library specified by the TemplateSrc property for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
slreportgen.report.Signal.createTemplate Create signal reporter template
slreportgen.report.Signal.customizeReporter Create subclass of slreportgen.report.Signal class
slreportgen.report.Signal.getClassFolder Get location of folder that contains
slreportgen.report.Signal class definition file
copy Create copy of a Simulink reporter object and make
deep copies of certain property values
getImpl Get implementation of reporter
Examples
Report a Signal
Import the MATLAB and Simulink Report API packages so that you do not have to use long, fully
qualified class names.
import mlreportgen.report.*
import slreportgen.report.*
Load a model.
model_name = "slrgex_vdp";
load_system(model_name);
7-124
slreportgen.report.Signal class
rpt = slreportgen.report.Report("signal_example","pdf");
append(rpt,slreportgen.report.Diagram(model_name));
Get the port handle for the signal that you want to report.
ph = get_param("slrgex_vdp/x1","PortHandles");
port = ph.Outport;
ch = Chapter("x1");
Create a Signal reporter for the signal and append the reporter to the chapter.
signalRptr = slreportgen.report.Signal(port);
append(ch,signalRptr);
Add the chapter to the report. Close and view the report.
append(rpt,ch);
close(rpt);
rptview(rpt);
See Also
slreportgen.finder.SignalFinder | slreportgen.finder.SignalResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
“Signal Basics”
Introduced in R2021a
7-125
7 Classes
slreportgen.report.SimulinkObjectProperties class
Package: slreportgen.report
Description
The SimulinkObjectProperties reporter generates tables that list the properties and property
values of Simulink objects.
Note To use a Simulink object properties reporter in a report, you must create the report using the
slreportgen.report.Report class.
Construction
reporter = SimulinkObjectProperties() creates an empty Simulink object properties
reporter. Use the Object property to specify the object to report.
To specify the list of Simulink object properties to include in the generated properties table, use the
Properties property of the reporter. If you do not specify any properties, the reporter includes a
default set of properties based on the object type. For example, the property table for a block
includes the properties set by its parameter dialog box.
To customize the format of the generated property table, use the PropertyTable property.
Note This reporter compiles the model containing the object to be reported if the model is not
already compiled. Compiling the model is necessary to propagate values to properties that are
unspecified when the model has not been compiled. The model is uncompiled when you close the
report that contains the generated property table.
Input Arguments
7-126
slreportgen.report.SimulinkObjectProperties class
Properties
Object — Simulink object to report
path string or character vector | object handle
Simulink object whose properties to report, specified as a path to or handle of the specified object.
The Object value must be one of these types of objects:
• model
• block
• annotation
• port
• line
• line segment
Choice to display property names as dialog box prompts, specified as a logical. If true and the
property appears on the dialog box of the object, the table lists its dialog box prompt instead of its
property name. Otherwise, the generated property table lists the property using its property name.
Whether to show properties with empty values, specified as a logical. If false, the generated object
properties table omits object properties whose value is empty. If true, the table includes properties
whose value is empty.
A cell array of names of object properties to be reported, specified as a cell array of strings or
character vectors. If you do not specify any properties, the reporter determines a set of properties to
report.
Source of the template for this reporter, specified in one of these ways:
7-127
7 Classes
• Character vector or string scalar that specifies the path of the file that contains the template for
this reporter
• Reporter or report whose template is used for this reporter or whose template library contains the
template for this reporter
• DOM document or document part whose template is used for this reporter or whose template
library contains the template for this reporter
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
createTemplate Create Simulink object properties reporter template
customizeReporter Create custom Simulink object properties class
getClassFolder Simulink object properties class definition file location
Inherited Methods
Examples
Add Properties Table to Report
Use the SimulinkObjectProperties reporter to add a properties table for the slrgex_vdp model
to the report.
import slreportgen.report.*
import mlreportgen.report.*
model_name = "slrgex_vdp";
load_system(model_name);
7-128
slreportgen.report.SimulinkObjectProperties class
rpt = slreportgen.report.Report("output","pdf");
chapter = Chapter(model_name);
rptr = SimulinkObjectProperties(model_name);
add(chapter, rptr);
add(rpt, chapter);
close(rpt);
close_system(model_name);
rptview(rpt);
Add a properties table to a report and include properties for a model line segment only.
import slreportgen.report.*
import mlreportgen.report.*
model_name = "slrgex_vdp";
rpt = slreportgen.report.Report("output","pdf");
chapter = Chapter(model_name);
load_system(model_name);
ph = get_param("slrgex_vdp/Mu","PortHandles");
outPort = ph.Outport;
line = get_param(outPort,"Line");
rptr = SimulinkObjectProperties(line);
rptr.Properties = {"Parent","SourcePort","StorageClass"};
add(chapter,rptr);
add(rpt,chapter);
close(rpt);
close_system(model_name);
rptview(rpt);
See Also
slreportgen.report.Report | mlreportgen.report.BaseTable
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-129
7 Classes
slreportgen.report.StateflowObjectProperties
class
Package: slreportgen.report
Description
The StateflowObjectProperties reporter generates tables that list the properties and property
values of Stateflow objects.
Note To use a Stateflow object properties reporter in a report, you must create the report using the
slreportgen.report.Report class.
Construction
reporter = StateflowObjectProperties() creates an empty Stateflow object properties
reporter. Use the properties of this reporter to specify reporting on these Stateflow objects:
Note This reporter compiles the model containing the object to be reported if the model is not
already compiled. Compiling the model is necessary to propagate values to properties that are
unspecified when the model has not been compiled. The model is in an uncompiled state when you
close the report that contains the generated property table.
Input Arguments
7-130
slreportgen.report.StateflowObjectProperties class
Properties
Object — Stateflow object to report
Stateflow object handle
Stateflow object whose properties to report, specified as the path string or character vector or as the
handle of the specified object.
Whether to show properties with empty values, specified as a logical. If false, the generated object
properties table omits object properties whose value is empty. If true, the table includes properties
whose value is empty.
Names of object properties to be reported, specified as a cell array of strings or character vectors.
A cell array of names of object properties to be reported, specified as a cell array of strings or
character vectors. If you do not specify any properties, the reporter determines a set of properties to
report.
Source of the template for this reporter, specified in one of these ways:
• Character vector or string scalar that specifies the path of the file that contains the template for
this reporter
• Reporter or report whose template is used for this reporter or whose template library contains the
template for this reporter
• DOM document or document part whose template is used for this reporter or whose template
library contains the template for this reporter
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
7-131
7 Classes
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Inherited Methods
Examples
Add Stateflow Chart Properties Table to Report
Add a table that reports the properties of the shift_model chart in slrgex_sf_car model.
import slreportgen.report.*
import mlreportgen.report.*
import slreportgen.utils.*
model_name = 'slrgex_sf_car';
load_system(model_name);
rpt = slreportgen.report.Report('output','pdf');
chapter = Chapter(model_name);
chart = block2chart('slrgex_sf_car/shift_logic');
rptr = StateflowObjectProperties(chart);
add(chapter, rptr);
add(rpt, chapter);
close(rpt);
close_system(model_name);
rptview(rpt);
See Also
slreportgen.report.Report | mlreportgen.report.BaseTable
7-132
slreportgen.report.StateflowObjectProperties class
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-133
7 Classes
slreportgen.report.SystemHierarchy class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Creates a system hierarchy reporter that generates a nested list of the subsystems of a Simulink
model or subsystem in a report.
Note To use a system hierarchy reporter in a report, you must create the report using the
slreportgen.report.Report class or subclass.
Class Attributes
HandleCompatible true
Creation
Description
Properties
Source — Simulink model or subsystem
[] (default) | string scalar | character vector | handle
Simulink model or subsystem, specified as a string scalar or character vector that contains the path
to the model or subsystem, or as a handle to the model or subsystem.
7-134
slreportgen.report.SystemHierarchy class
Maximum number of levels of ancestors of the source subsystem to include in the generated list,
specified as a nonnegative integer scalar. For example, if MaxAncestorLevel is 2, the list includes
the source and up to two levels of ancestors. If MaxAncestorLevel is Inf, the default value, the list
includes all ancestors. If MaxAncestorLevel is zero, the list does not include ancestors.
Maximum number of levels of descendants of the source model or subsystem to include in the
generated list, specified as a nonnegative integer scalar. For example, if MaxDescendantLevel is 2,
the list includes the source and up to two levels of descendants. If MaxDescendantLevel is Inf, the
default value, the list includes all descendants. If MaxDescendantLevel is zero, the list does not
include descendants.
Whether to include peers of the source subsystem in the generated list, specified as true or false.
Whether to emphasize the source model or subsystem in the generated list, specified as true or
false. If EmphasizeSource is true, the name of the source model or subsystem is formatted
according to the TextFormatter property. Otherwise, it is formatted like the other items in the list.
Text formatter object that formats the name of the source model or subsystem in the generated list,
specified as an mlreportgen.dom.Text object. This property applies only if the EmphasizeSource
property is true. The initial value of the SourceTextFormatter property is an
mlreportgen.dom.Text object with the Bold and Italic properties set to true. To customize the
appearance of the name in the generated list, modify the mlreportgen.dom.Text object properties
or replace the object with a customized mlreportgen.dom.Text object. If you add text to the
default or replacement text object, the text appears in front of the source name in the generated
report.
Whether the generated list of descendants of the source system includes masked subsystems,
specified as true or false. If IncludeMaskedSubsystems is true, the list includes masked
subsystems and their descendant subsystems, as long as the number of levels below the source
subsystem is less than or equal to the value of the MaxDescendantLevel property.
7-135
7 Classes
To enable the system hierarchy reporter to link masked subsystems to the corresponding diagrams in
the report, in the diagram reporter, set the MaskedSystemLinkPolicy property to 'system'.
Whether the generated list of descendants of the source system includes referenced models, specified
as true or false. If IncludeReferencedModels is true, the list includes referenced models and
their descendant subsystems, as long as the number of levels below the source subsystem is less than
or equal to the value of the MaxDescendantLevel property.
Whether the generated list of descendants of the source system includes subsystems that link to a
Simulink library subsystem, specified as true or false. The list includes a linked subsystem or one
of its descendant subsystems, only if all of these conditions are true:
Whether the generated list of descendants of the source system includes subsystems that link to a
user-defined library subsystem, specified as true or false. The list includes a linked subsystem, or
one of its descendant subsystems, only if all of these conditions are true:
Variants of a variant block to include in the generated list of descendants of the source system,
specified as one of the values in the table. You can specify the value as a string scalar or a character
vector.
Value Description
"Active" Active variants (default)
"All" All variants
"ActivePlusCode" Active variants and code variants
The list includes the variants only if the number of levels below the source subsystem is less than or
equal to the value of the MaxDescendantLevel property.
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
7-136
slreportgen.report.SystemHierarchy class
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
slreportgen.report.SystemHierarchy.createTemplate Create system hierarchy reporter template
slreportgen.report.SystemHierarchy.customizeReporter Create custom system hierarchy reporter
class
slreportgen.report.SystemHierarchy.getClassFolder Get location of system hierarchy reporter
class definition file
copy Create copy of a Simulink reporter object
and make deep copies of certain property
values
getImpl Get implementation of reporter
Examples
% Create a report
rpt = slreportgen.report.Report("output","pdf");
7-137
7 Classes
rptr = SystemHierarchy(model);
7-138
slreportgen.report.SystemHierarchy class
To see the diagram corresponding to a subsystem, click the subsystem in the list.
See Also
slreportgen.finder.DiagramFinder
Topics
“Report Systems Hierarchically” on page 4-25
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
7-139
7 Classes
slreportgen.report.SystemIO class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Create a reporter that reports on signals entering or leaving a Simulink model or subsystem.
Note To use a SystemIO reporter in a report, you must create the report using the
slreportgen.report.Report class.
Class Attributes
HandleCompatible true
Creation
Description
Properties
Object — Model or subsystem to be reported
string scalar | character vector | handle | slreportgen.finder.DiagramResult object |
slreportgen.finder.BlockResult object
7-140
slreportgen.report.SystemIO class
Simulink model or subsystem to be reported, specified as a string scalar or character vector that
contains the path to the model or subsystem, as a handle to the model or subsystem, as an
slreportgen.finder.DiagramResult object, or as an slreportgen.finder.BlockResult
object.
Attributes:
GetAccess public
SetAccess public
List of properties to report for each input, specified as a string array or a cell array of character
vectors. By default, the list includes Port, Inport Block, Source, Name, and DataType. The value
reported for Inport Block is the name of the Inport block that corresponds to the input signal in
the system. You can include these signal properties in the list:
You also can specify these block properties of the corresponding Inport block:
Attributes:
GetAccess public
SetAccess public
List of properties to report for each output, specified as a string array or a cell array of character
vectors. By default, the list includes Port, Outport Block, Destination, Name, and DataType.
The value reported for Outport Block is the name of the Outport block that corresponds to the
output signal in the system. You can include these signal properties in the list:
You also can specify these block properties of the corresponding Outport block:
Attributes:
GetAccess public
SetAccess public
Whether to show a table that summarizes the inputs to the subsystem or model, specified as true or
false. The InputSummaryProperties property determines which input properties the table
includes.
Attributes:
GetAccess public
SetAccess public
7-141
7 Classes
Whether to show a table that summarizes the outputs from the subsystem or model, specified as true
or false. The OutputSummaryProperties property determines which output properties the table
includes.
Attributes:
GetAccess public
SetAccess public
Whether to show details for each input or output, specified as true or false. If ShowDetails is
true, the reporter inserts slreportgen.report.SimulinkObjectProperties reporters after
the input and output summary tables. If Object is a model, details about the input or output blocks
are included. If Object is a subsystem, details about the input or output ports are included. The port
numbers in the summary tables link to the corresponding SimulinkObjectProperties reporter for
that port.
Attributes:
GetAccess public
SetAccess public
GetAccess public
SetAccess public
GetAccess public
SetAccess public
7-142
slreportgen.report.SystemIO class
Attributes:
GetAccess public
SetAccess public
GetAccess public
SetAccess public
GetAccess public
SetAccess public
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Attributes:
GetAccess public
SetAccess public
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template specified by the TemplateSrc
property of this reporter.
7-143
7 Classes
Attributes:
GetAccess public
SetAccess public
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Attributes:
GetAccess public
SetAccess public
Methods
Public Methods
slreportgen.report.SystemIO.createTemplate Copy the default slreportgen.report.SystemIO
reporter template
slreportgen.report.SystemIO.customizeReporter Create subclass of slreportgen.report.SystemIO
class
slreportgen.report.SystemIO.getClassFolder Get location of folder that contains the
slreportgen.report.SystemIO class definition file
copy Create copy of a Simulink reporter object and
make deep copies of certain property values
getImpl Get implementation of reporter
Examples
This example uses an slreportgen.report.SystemIO reporter to report on the inputs and outputs
of a model and its subsystems.
model_name = "slrgex_f14";
load_system(model_name);
% Create a Simulink report
rpt = slreportgen.report.Report("SystemIO_example","docx");
7-144
slreportgen.report.SystemIO class
Tips
• The input and output signal properties reported by the SystemIO reporter correspond to Simulink
properties, which you can query by using get_param. For example, the DataType and
Dimensions properties correspond to the Simulink CompiledPortDataType and
CompiledPortDimensions properties of the port handles.
• For bus signals, Simulink determines the values of the CompiledPortDataType and
CompiledPortDimensions properties based on whether the signal is a nonvirtual or virtual bus.
Compatibility Considerations
Default values of InputSummaryProperties and OutputSummaryProperties
Behavior changed in R2021b
Before R2021b, a SystemIO object always reported the Inport or Outport block for a model signal
and the port number for a subsystem signal, regardless of the values of the
InputSummaryProperties or OutputSummaryProperties properties. Starting in R2021b, to
report the Inport or Outport block for either a model or subsystem signal, you must include Inport
Block or Outport Block in the property list in the InputSummaryProperties or
OutputSummaryProperties property. To report the port number, you must include Port in the
property list.
Starting in R2021b, you can specify Inport Block instead of Inport Block Name in the
InputSummaryProperties property and you can specify Outport Block instead of Outport
Block Name in the OutputSummaryProperties property. Inport Block Name and Outport
Block Name are still valid.
See Also
slreportgen.finder.DiagramResult | slreportgen.finder.BlockResult
7-145
7 Classes
Topics
“Report System Inputs and Outputs” on page 4-34
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2020a
7-146
slreportgen.report.TestSequence class
slreportgen.report.TestSequence class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Use an object of the slreportgen.report.TestSequence class to report on a Simulink Test
Sequence block. Using a Test Sequence block in a Simulink model requires Simulink Test.
• Property tables for all of the symbols — input, output, local, constant, parameter, and data store
memory
• A nested list for the step hierarchy
• Details for each step including the step description, When condition, action statements, and a table
of transition conditions and next steps
If the Test Sequence block uses scenarios, the TestSequence reporter includes the scenario
parameter in the parameters table and a list for each scenario in the step hierarchy. In the report,
scenarios are identified by the scenario icon. The active scenario is also identified by the word
Active followed by the active scenario icon. For example:
The reporter adds a note to the report when the active scenario is controlled in the workspace. In this
case, the active scenario is not identified in the report.
Use the TestSequence reporter properties to filter the content and customize the content
formatting.
Class Attributes
HandleCompatible true
7-147
7 Classes
Creation
Description
Properties
Object — Test Sequence block to report
[] (default) | character vector | string scalar | handle | slreportgen.finder.BlockResult |
slreportgen.finder.DiagramElementResult
Whether to include symbols in the report, specified as true or false. If IncludeSymbols is true,
the report includes property tables for the symbols. In the input and output symbol property tables,
the symbols are sorted by the port number. In the local, constant, parameter, and data store memory
tables, the symbols are sorted by the symbol name.
If the model was compiled before report generation, the values in the property tables are the values
after compilation. Otherwise, the property values are the values before compilation and a note at the
end of the Symbols section states that the model was not compiled. By default, models are compiled
during report generation. You can control whether a model is compiled during report generation by
setting the CompileModelBeforeReporting property of the slreportgen.report.Report
object that includes this reporter.
Data Types: logical
Whether to include step content, specified as true or false. If IncludeStepContent is true, the
report includes the content for each step. In the reported step content, the step name links to the
7-148
slreportgen.report.TestSequence class
step hierarchy in the report. You can filter the reported step content by using the
IncludeStepDescription, IncludeStepWhenCondition, IncludeStepAction, IncludeStepTransitions, and
IncludeStepRequirements properties.
Data Types: logical
Whether to include the step description in the content reported for a step, specified as true or
false.
Data Types: logical
Whether to include the step When condition in the content reported for a step, specified as true or
false. The When condition is the condition that activates a When decomposition child step.
Data Types: logical
Whether to include the step actions in the content reported for a step, specified as true or false.
Data Types: logical
Whether to include the step transitions table in the content reported for a step, specified as true or
false. The step transitions table contains the transition conditions and the next steps.
Data Types: logical
Whether to include a link to the step requirements in the content reported for a step, specified as
true or false. Linking to the step requirements requires Simulink Requirements.
Data Types: logical
7-149
7 Classes
The default value of this property is an UnorderedList object with the StyleName property set to
the TestSequenceList style, which is defined in the default template for a TestSequence reporter.
To customize the appearance of the list, modify the properties of the default UnorderedList object
or replace the object with your own UnorderedList or OrderedList object.
Source of the template for this reporter, specified in one of these ways:
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Public Methods
slreportgen.report.TestSequence.createTemplate Create Test Sequence block reporter template
slreportgen.report.TestSequence.customizeReporter Create custom Test Sequence block reporter
class
slreportgen.report.TestSequence.getClassFolder Get location of Test Sequence block reporter
class definition file
copy Create copy of a Simulink reporter object and
make deep copies of certain property values
getImpl Get implementation of reporter
Examples
7-150
slreportgen.report.TestSequence class
Import the MATLAB Report and Simulink Report API packages so that you do not have to use long,
fully qualified class names.
import mlreportgen.report.*
import slreportgen.report.*
rpt = slreportgen.report.Report("myTestSequenceReport","pdf");
model_name = "sltestTestSequenceExample";
load_system(model_name);
Find and load the test harness that contains the Test Sequence block to report.
harness = sltest.harness.find(strcat(model_name,"/shift_controller"));
sltest.harness.load(harness.ownerFullPath,harness.name);
testSeqObj = strcat(harness.name,"/Test Sequence");
chapter = Chapter(testSeqObj);
rptr = TestSequence(testSeqObj);
Append the reporter to the chapter and the chapter to the report.
append(chapter,rptr);
append(rpt,chapter);
Close the report, test harness, and model. View the report.
close(rpt);
sltest.harness.close(harness.ownerFullPath,harness.name);
close_system(model_name);
rptview(rpt);
See Also
Test Sequence
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
“Test Sequence Editor” (Simulink Test)
Introduced in R2020b
7-151
7 Classes
slreportgen.report.TruthTable class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Create a Simulink truth table block or Stateflow truth table object reporter.
Note To use a TruthTable reporter in a report, you must create the report using the
slreportgen.report.Report class.
Construction
rptr = TruthTable() creates an empty TruthTable reporter. Use its properties to specify the
truth table on which to report and specify report options and format.
rptr = TruthTable(Name,Value) creates a truth table reporter with additional options specified
by one or more Name,Value pair arguments. Name is a property name and Value is the
corresponding value. Name must appear inside single quotes ('') or double quotes (" ") . You can
specify several name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
Input Arguments
Properties
Object — Truth table block or object
Simulink Truth Table block path | Simulink Truth Table block handle | Stateflow Truth Table handle
Simulink Truth Table block or Stateflow truth table object, specified as a path or handle.
Specify whether to include headers in the truth table condition table, specified as a logical. If this
property is true, the report includes column headers that identify the contents of the table columns.
7-152
slreportgen.report.TruthTable class
Specify whether to include row numbers in the truth table condition table, specified as a logical. If
this property is true, each row of the condition table starts with a row number.
Specify whether to include the condition column in the truth table condition table, specified as a
logical. If this property is true, the report includes the conditions that trigger the decisions.
Specify whether to include the description column in the truth table condition table, specified as a
logical. If this property is true, the report includes descriptions of the truth table conditions.
Reporter used by the TruthTable reporter to create the truth table condition table. This property is
set by default to an instance of a BaseTable reporter.
Use the associated BaseTable reporter properties to customize the appearance of the condition
table. If the condition table is too wide to fit legibly on a page, use the MaxCols property of the
BaseTable reporter to generate the condition table as a set of table slices that fit legibly.
Note The TruthTable reporter always repeats the first two columns of the condition table in each
slice. It does not use the RepeatCols property of the BaseTable or custom reporter.
Specify whether to include headers in the truth table action table, specified as a logical. If this
property is true, the action table includes the column headers, such as "Description" that identify
the contents of each column.
Specify whether to include row numbers in the truth table action table, specified as a logical. If this
property is true, each row of the action table starts with a row number.
Specify whether to include the action column in the truth table action table, specified as a logical. If
this property is true, each row of the action table lists the executable action statements for each
action.
Specify whether to include the description column in the truth table action table, specified as a
logical. If this property is true, each row of the action table contains a description of the
corresponding action.
7-153
7 Classes
Reporter used by the TruthTable reporter to create the truth table's action table. This property is
set by default to an instance of a BaseTable reporter. You can customize the appearance of the
action table by changing the properties of this table reporter or by replacing it with a customized
version of a BaseTable reporter.
Source of the template for this reporter, specified in one of these ways:
• Character vector or string scalar that specifies the path of the file that contains the template for
this reporter
• Reporter or report whose template is used for this reporter or whose template library contains the
template for this reporter
• DOM document or document part whose template is used for this reporter or whose template
library contains the template for this reporter
The specified template must be the same type as the report to which this reporter is appended. For
example, for a Microsoft Word report, TemplateSrc must be a Word reporter template. If the
TemplateSrc property is empty, this reporter uses the default reporter template for the output type
of the report.
Name of the template for this reporter, specified as a character vector or string scalar. The template
for this reporter must be in the template library of the template source (TemplateSrc) for this
reporter.
Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the
link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a LinkTarget object. The link target immediately precedes the content of this
reporter in the output report.
Methods
Inherited Methods
7-154
slreportgen.report.TruthTable class
Examples
Add Truth Table to a PDF Report
import slreportgen.report.*
import mlreportgen.report.*
model_name = 'sf_climate_control';
openExample(model_name);
rpt = slreportgen.report.Report('output','pdf');
truthtableobj = 'sf_climate_control/ClimateController';
chapter = Chapter(truthtableobj);
rptr = TruthTable(truthtableobj);
rptr.IncludeConditionTableRowNumber = false;
add(chapter,rptr)
add(rpt,chapter)
close(rpt)
close_system(model_name)
rptview(rpt)
7-155
7 Classes
model_name = 'sf_climate_control';
openExample('sf_climate_control');
rpt = slreportgen.report.Report('output','pdf');
truthtableobj = 'sf_climate_control/ClimateController';
chapter = Chapter(truthtableobj);
rptr = TruthTable(truthtableobj);
rptr.IncludeConditionTableRowNumber = false;
rptr.ConditionTableReporter.MaxCols = 4;
add(chapter,rptr)
add(rpt,chapter)
close(rpt)
close_system(model_name)
rptview(rpt)
7-156
slreportgen.report.TruthTable class
See Also
mlreportgen.report.BaseTable | slreportgen.finder.DiagramElementResult |
slreportgen.finder.StateflowDiagramElementFinder |
slreportgen.finder.DiagramElementFinder | slreportgen.finder.BlockResult |
slreportgen.finder.BlockFinder | mlreportgen.utils.TableSlice |
mlreportgen.utils.TableSlicer | slreportgen.utils.isTruthTable
Introduced in R2018b
7-157
7 Classes
slreportgen.finder.AnnotationFinder class
Package: slreportgen.finder
Description
Find annotation objects in a Simulink or Stateflow diagram.
Construction
finder = AnnotationFinder(diagram) creates a finder that finds by default all annotations in
the specified diagram. To constrain the search to specific types of annotations, use the properties of
this finder.
1 To return the search results as an array, use the find method. Add the results directly to a
report or process the results in a for loop.
2 To iterate through the results one at a time, use the hasNext and next methods in a while loop.
Input Arguments
Properties
Container — Diagram to search
path | handle | chart ID | chart object
7-158
slreportgen.finder.AnnotationFinder class
Properties of objects to find, specified as a cell array of name-value pairs. The finder returns only
objects that have the specified properties with the specified values.
Example: finder.Properties = {'Gain','5'}
Methods
results = find(finder) finds annotations in the diagram specified by the finder. This method
returns the annotations it finds wrapped in result objects of type
slreportgen.finder.DiagramElementResult. To add tables of the annotation properties, add
the results objects directly to the report or add them to a reporter that you then add to a report. The
reports to which you can add the results of this method must be reports of type
slreportgen.report.Report.
tf = hasNext(finder) determines if the diagram that the finder searches contains at least one
annotation. If the diagram has at least one annotation, the hasNext method queues that annotation
as the next annotation that the next method will return. The hasNext method then returns true.
Use the next method to obtain that annotation. On subsequent calls, the hasNext method
determines if the diagram has an annotation that the next method has not yet retrieved. It queues
the annotation for the next method to retrieve and returns true. If there are no more annotations to
be retrieved, this method returns false. To search a diagram progressively for annotations, use the
hasNext method with the next method in a while loop.
result = next(finder) returns the next search result in the result queue that the hasNext
method created. This method returns the annotation that it finds wrapped in a result object of type
slreportgen.finder.DiagramElementResult. To add tables of the annotation properties, add
the results objects directly to the report or add them to a reporter that you then add to a report. The
reports to which you can add the results of this method must be of type
slreportgen.report.Report.
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Examples
Find Annotations in a Model
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = 'slrgex_sf_car';
load_system(model_name);
rpt = slreportgen.report.Report('output','pdf');
7-159
7 Classes
add(rpt, TitlePage("Title",...
sprintf('Annotations in %s Model',model_name)));
add(rpt, TableOfContents);
diagFinder = SystemDiagramFinder(model_name);
diagrams = find(diagFinder);
while hasNext(diagFinder)
diagram = next(diagFinder);
annotFinder = AnnotationFinder(diagram.Object);
annotations = find(annotFinder);
if ~isempty(annotations)
chapter = Chapter("Title",diagram.Name);
add(chapter, diagram);
sect = Section("Title","Annotations");
add(sect,annotations);
add(chapter,sect);
add(rpt,chapter);
end
end
close(rpt);
close_system(model_name);
rptview(rpt);
See Also
slreportgen.report.Report | slreportgen.finder.SystemDiagramFinder |
slreportgen.report.SimulinkObjectProperties | slreportgen.report.Diagram |
slreportgen.finder.BlockFinder | slreportgen.finder.DiagramElementResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-160
slreportgen.finder.BlockFinder class
slreportgen.finder.BlockFinder class
Package: slreportgen.finder
Description
Finds blocks in a Simulink diagram.
Construction
finder = BlockFinder(diagram) creates a finder that finds by default all types of blocks in the
specified Simulink block diagram. To constrain the search to specific types of blocks, use the
properties of the finder.
1 To return the search results as an array, use the find method. Add the results directly to a
report or process the results in a for loop.
2 To iterate through the results one at a time, use the hasNext and next methods in a while loop.
finder = BlockFinder(Name,Value) sets properties using name-value pairs. You can specify
multiple name-value pair arguments in any order. Enclose each property name in single quotes.
Input Arguments
Properties
Container — Diagram to search
path | handle
Type of block to find, such as Gain, specified as a string or character array, or a set of block types to
find, specified as a string array or a cell array of character arrays.
7-161
7 Classes
Whether to include commented-out blocks in the search results, specified as a logical. If false,
commented-out blocks are excluded from the search results.
Variants of a variant block to include in the search results, specified as one of the values in the table.
You can specify the value as a string scalar or a character vector.
Value Description
"Active" Active variants (default)
"All" All variants
"ActivePlusCode" Active variants and code variants
Properties of objects to find, specified as a cell array of name-value pairs. The finder returns only
objects that have the specified properties with the specified values.
Example: finder.Properties = {'Gain','5'}
Methods
results = find(finder) finds blocks in the diagram specified by the finder. This method returns
the blocks it finds wrapped in result objects of type slreportgen.finder.BlockResult. To add
tables of the block properties, add the results objects directly to the report or add them to a reporter
that you then add to a report. The reports to which you can add the results of this method must be
of reports of type slreportgen.report.Report
tf = hasNext(finder) determines if the diagram that the finder searches contains at least one
block. If the diagram has at least one block, the hasNext method queues that block as the next block
that the next method will return. The hasNext method then returns true. Use the next method to
obtain that block. On subsequent calls, the hasNext method determines if the diagram has a block
that the next method has not yet retrieved. It queues the block for the next method to retrieve and
returns true. If there are no more blocks to be retrieved, this method returns false. To search a
diagram progressively for blocks, use the hasNext method with the next method in a while loop.
result = next(finder) returns the next search result in the result queue that the hasNext
method created. This method returns the block that it finds wrapped in a result object of type
slreportgen.finder.BlockResult. To add tables of the block properties, add the result object to
the report directly or add it to a reporter that you then add to a report. The reports to which you can
add the results of this method must be of type slreportgen.report.Report.
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
7-162
slreportgen.finder.BlockFinder class
Examples
Find Inport and Outport Blocks in a Model
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = 'slrgex_sf_car';
load_system(model_name)
rpt = slreportgen.report.Report('output','pdf');
add(rpt,TitlePage("Title",...
sprintf('I/O Blocks in %s Model',model_name)));
add(rpt,TableOfContents);
diagFinder = SystemDiagramFinder(model_name);
diagFinder.IncludeRoot = false;
while hasNext(diagFinder)
diagram = next(diagFinder);
chapter = Chapter("Title",diagram.Name);
add(chapter,diagram)
sect = Section("Title","Inport Blocks");
ioFinder = BlockFinder(diagram.Object);
ioFinder.BlockTypes = "Inport";
blocks = find(ioFinder);
for block = blocks
add(sect,block)
end
add(chapter,sect);
sect = Section("Title","Outport Blocks");
ioFinder = BlockFinder(diagram.Object);
ioFinder.BlockTypes = "Outport";
outblocks = find(ioFinder);
for block = outblocks
add(sect,block)
end
add(chapter,sect)
add(rpt,chapter)
end
close(rpt)
close_system(model_name)
rptview(rpt)
See Also
slreportgen.report.Report | slreportgen.finder.DiagramFinder |
slreportgen.finder.DiagramElementFinder |
slreportgen.finder.SystemDiagramFinder |
slreportgen.report.SimulinkObjectProperties | slreportgen.report.Diagram |
slreportgen.report.SimulinkObjectProperties | slreportgen.finder.BlockResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
7-163
7 Classes
Introduced in R2017b
7-164
slreportgen.finder.BlockResult class
slreportgen.finder.BlockResult class
Package: slreportgen.finder
Description
Block search result object for a block in a Simulink diagram.
Construction
result = BlockResult(block) creates a search result object for a block found by a
BlockFinder. The result object contains the Simulink block.
Note The simulink.finder.BlockFinder find method creates objects of this type for each block
that it finds. You do not need to create this object yourself.
finder = BlockResult(Name,Value) sets properties using name-value pairs. You can specify
multiple name-value pair arguments in any order. Enclose each property name in single quotes.
Input Arguments
Properties
Object — Block handle
handle
This read-only property contains a handle to the block returned in this result.
This read-only property specifies the name of the block returned in this result.
This read-only property specifies the type of the block returned in this result.
Example: "Gain"
This read-only property returns the path of the block returned in this result.
7-165
7 Classes
Additional information to add to this result. You can set it to any type of value.
Methods
getDiagramReporter Returns Diagram reporter for this block result
getReporter Get block reporter
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
See Also
slreportgen.finder.BlockFinder | slreportgen.report.Report
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-166
slreportgen.finder.ChartDiagramFinder class
slreportgen.finder.ChartDiagramFinder class
Package: slreportgen.finder
Description
Finds Stateflow charts.
Construction
finder = ChartDiagramFinder(container) creates a finder that finds by default all
uncommented Stateflow chart diagrams in the specified container. To constrain the search to
specific types of diagrams, use the properties of this finder.
Note This finder can operate in either find or iterator mode. In find mode, use its find method to
return the results of a search as an array of results. In iterator mode, use its hasNext and next
methods to return the results of a search one-by-one. When searching in models that have many
model references, use iterator mode. Iterator mode closes a model after compiling and searching it,
whereas find mode keeps all the models that it searches open. Having many open models can
consume all system memory and slow report generation. Iterator mode is slower than find mode, so
use find mode to search models that reference few or no other models.
Input Arguments
Properties
Container — Chart container to search
path | handle | chart ID | chart object
7-167
7 Classes
Depth of system diagram search, specified as inf or a positive integer. SearchDepth specifies how
many levels deep to search a diagram container for diagrams. To search all levels, use inf.
Choice to search masked subsystems, specified as a logical. If this property is true, the finder
searches masked Subsystem blocks in the diagram container. It searches to the specified
SearchDepth and includes the diagrams it finds in the search results.
Choice to search referenced models, specified as a logical. If this property is true, the finder
searches models referenced in the diagram container. It searches to the specified SearchDepth and
includes the diagrams it finds in the search results.
Choice to search Simulink library links, specified as a logical. If both this property and
IncludeMaskedSubsystems are true, the finder searches links in the diagram container to both
Subsystem and masked Subsystem blocks in Simulink libraries. It searches to the specified
SearchDepth and includes the diagrams it finds in the search results. If this property is true, but
IncludeMaskedSubsystems is false, the finder searches only links to Subsystem blocks in
Simulink libraries.
Choice to search user library links, specified as a logical. If this property is true and the
IncludeMaskedSubsystems property is true, the finder searches links in the diagram container to
Subsystem and masked Subsystem blocks in user libraries. It searches to the specified SearchDepth
and includes the diagrams it finds in the search results. If this property is true, but the
IncludeMaskedSubsystems property is false, the finder searches only links to Subsystem blocks
in user libraries.
Choice to include commented-out charts in the search results, specified as a logical. If false,
commented-out charts are excluded from the search results.
Variants to search for diagrams, specified as a string or character vector. The default value is
Active. Valid values are:
7-168
slreportgen.finder.ChartDiagramFinder class
Properties of objects to find, specified as a cell array of name-value pairs. The finder returns only
objects that have the specified properties with the specified values.
Example: finder.Properties = {'Gain','5'}
Whether to close models, specified as true or false. If true, the next method of the finder closes
the currently open model before moving to the next model to search. Closing models prevents
excessive consumption of memory when searching a model that references many models.
Note The find method of the finder ignores this property and leaves all referenced models open.
For this reason, you should not use the find method to search models with many model references.
Methods
results = find(finder) finds chart diagrams in the container specified by the finder. The
finder is an slreportgen.finder.ChartDiagramFinder object. results is an array of
slreportgen.finder.DiagramResult objects, each of which contains a chart diagram found by
this method. Adding this array to a report or reporter adds images of the charts that it contains. The
reports to which you can add the results of this method are reports of type
slreportgen.report.Report or another reporter object, such as an
slreportgen.report.Chapter reporter.
tf = hasNext(finder) determines if the container that the finder searches contains at least one
chart. If the container has at least one chart, the hasNext method queues that chart as the next
chart that the next method will return. The hasNext method then returns true. Use the next
method to obtain that chart. On subsequent calls, the hasNext method determines if the container
has a chart that the next has not yet retrieved. It queues the chart for the next method to retrieve
and returns true. If there are no more charts exist to be retrieved, this method returns false. To
search a container progressively for charts, use the hasNext method with the next method in a
while loop.
Note If the current result is the last result in the search queue for the current chart and the
AutoCloseModel property is true, this method closes the current chart before it opens the next
chart. Although this increases search time, it reduces memory consumption when searching a chart
that references many other charts. If your chart does not reference many other charts, to speed up
the search, set the AutoCloseModel property to false or use the find method.
result = next(result) returns the next search result in the result queue that the hasNext
method created. The search result contains the resulting chart. Adding this result object to a report
or reporter adds a Diagram reporter for the chart.
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
7-169
7 Classes
Examples
Find Stateflow Charts
Create a report that includes images of all Stateflow charts in the sldemo_fuelsys model. Use a
separate chapter for each chart.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = "slrgex_fuelsys";
load_system(model_name);
rpt = slreportgen.report.Report("output","pdf");
chapter = Chapter("Charts");
finder = ChartDiagramFinder(model_name);
results = find(finder);
for result = results
section = Section("Title",result.Name);
add(section,result);
add(chapter,section);
end
add(rpt, chapter);
close(rpt);
close_system(model_name);
rptview(rpt);
See Also
slreportgen.finder.DiagramFinder |
slreportgen.finder.StateflowDiagramElementFinder |
slreportgen.finder.StateFinder | slreportgen.report.Report |
slreportgen.report.StateflowObjectProperties |
slreportgen.finder.DiagramElementFinder | slreportgen.finder.DiagramResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-170
slreportgen.finder.DataDictionaryFinder class
slreportgen.finder.DataDictionaryFinder class
Package: slreportgen.finder slreportgen.finder slreportgen.finder
slreportgen.finder
Superclasses: mlreportgen.finder.Finder
Description
Use an object of the slreportgen.finder.DataDictionaryFinder class to find Simulink data
dictionaries.
Class Attributes
HandleCompatible true
Creation
Description
You can constrain the search by setting the properties of the finder. Use the methods of the finder to
perform the search.
1 To return the search results as an array, use the find method. Add the results directly to a
report or process the results in a for loop.
2 To iterate through the results one at a time, use the hasNext and next methods in a while loop.
7-171
7 Classes
Properties
Container — Folders to search for data dictionaries
string array | character vector | cell array of character vectors
Folders to search for data dictionaries, specified as a string array, character vector, or cell array of
character vectors. Strings and character vectors can include the * and the ** wildcards. Characters
next to the ** wildcard must be file separators. For example, to find all data dictionaries in the
exampleFolder folder and its subfolders, set Container to "exampleFolder\**". If Container
is set to 'MATLABPath', the finder searches for data dictionaries in the current folder and all folders
on the MATLAB path.
Data dictionary to find, specified as a string scalar or character vector. The Name property value can
include the * wildcard. For example, to find all data dictionaries that begin with
sldemo_fuelsys_dd, set the Name property to "sldemo_fuelsys_dd*". The name or expression
specified in this property must have no file name extension or the extension .sldd.
Properties of the data dictionaries to find, specified as a cell array of name-value pairs. Use the
Properties property to filter the finder results by the data dictionary properties. The finder
searches the folders specified by the Container property for data dictionaries with names that
match the Name property and that have the specified properties values. For data dictionary
properties, see Simulink.data.Dictionary. For example, to return only the data dictionaries that
have access to the base workspace, set Properties to {'HasAccessToBaseWorkspace',true}.
Methods
Public Methods
7-172
slreportgen.finder.DataDictionaryFinder class
Examples
Import the MATLAB Report and Simulink Report API packages so that you do not have to use long,
fully qualified class names.
import mlreportgen.report.*
import slreportgen.finder.*
import slreportgen.report.*
Create a Simulink data dictionary finder to search the entire MATLAB path.
f = DataDictionaryFinder();
Constrain the finder to find only data dictionaries that have names that begin with slrgex_fuelsys.
f.Name = "slrgex_fuelsys*";
7-173
7 Classes
ch = Chapter("Data Dictionaries");
For each found dictionary, create a section and append it to the chapter.
while hasNext(f)
result = next(f);
s = Section(result.Name);
append(s,result);
append(ch,s);
end
Append the chapter to the report. Close and view the report.
append(rpt,ch);
close(rpt);
rptview(rpt);
See Also
slreportgen.finder.DataDictionaryResult | slreportgen.report.DataDictionary
Topics
“What Is a Data Dictionary?”
“Report Generation for Simulink and Stateflow Elements” on page 1-9
Introduced in R2020b
7-174
slreportgen.finder.DataDictionaryResult class
slreportgen.finder.DataDictionaryResult class
Package: slreportgen.finder slreportgen.finder
Description
An object of the slreportgen.finder.DataDictionaryResult class represents a result of a
search for data dictionaries. You can append a DataDictionaryResult object directly to a report.
Alternatively, you can use the getReporter method to access the
slreportgen.report.DataDictionary reporter for the result and then customize the reporter
and append it to the report.
Class Attributes
HandleCompatible true
Creation
You do not create an slreportgen.finder.DataDictionaryResult object explicitly. The
slreportgen.finder.DataDictionaryFinder find and next methods create an
slreportgen.finder.DataDictionaryResult object for each data dictionary that is found.
Properties
Object — Full path of data dictionary
string scalar
Full path of the data dictionary represented by this result, specified as a string scalar. This property is
read-only.
File name of data dictionary represented by this result, specified as a string scalar. This property is
read-only.
Additional information to save with this result. You can set this property to any type of value.
7-175
7 Classes
Methods
Public Methods
Examples
Import the MATLAB and Simulink Report API packages so that you do not have to use long, fully
qualified class names.
import mlreportgen.report.*
import slreportgen.report.*
Create a dictionary finder that searches the entire MATLAB path. Find only data dictionaries with
names that begin with slrgex__fuelsys.
f = slreportgen.finder.DataDictionaryFinder();
f.Name = "slrgex_fuelsys*";
Create a chapter with a section for each data dictionary result. For each result, customize the
reporter to include only the Name, Value, and Class properties in the Design Data summary table.
ch = Chapter("Data Dictionaries");
while hasNext(f)
result = next(f);
s = Section(result.Name);
rptr = getReporter(result);
rptr.SummaryProperties = ["Name" "Value" "Class"];
append(s,rptr);
append(ch,s);
end
Add the chapter to the report. Close and view the report.
append(rpt,ch);
close(rpt);
rptview(rpt);
7-176
slreportgen.finder.DataDictionaryResult class
The report has a section for each of the found dictionaries, slrgex_fuelsys.sldd and
slrgex_fuelsys_fuel_rate_control.sldd. The summary table for each dictionary includes
only the Name, Value, and Class properties.
See Also
slreportgen.report.DataDictionary | slreportgen.finder.DataDictionaryFinder
Topics
“What Is a Data Dictionary?”
“Report Generation for Simulink and Stateflow Elements” on page 1-9
Introduced in R2020b
7-177
7 Classes
slreportgen.finder.DiagramElementFinder class
Package: slreportgen.finder
Description
Finds elements in a Simulink block or Stateflow chart diagram.
Construction
finder = DiagramElementFinder(diagram) creates a finder that finds elements of a Simulink
block or Stateflow chart diagram. By default this finder finds blocks, annotations, lines, states, and
other elements in the diagram. Use the properties of the finder to constrain the search to specific
types of elements.
1 To return the search results as an array, use the find method. Add the results directly to a
report or process the results in a for loop.
2 To iterate through the results one at a time, use the hasNext and next methods in a while loop.
Input Arguments
Properties
Container — Diagram to search
path | handle | chart ID | chart object
7-178
slreportgen.finder.DiagramElementFinder class
• Stateflow chart ID
• Stateflow chart object
Types of Simulink or Stateflow diagram elements to find, specified as a string, character array, array
of strings, or a cell array of character arrays. If the type is an array, it specifies a set of element types.
The default is All or all, which finds all elements in all diagrams. Use one of these values to
constrain the search to specific diagram element types. You can use either the fully qualified name or
the short name.
Choice to include commented-out diagram elements in the search results, specified as a logical. If
false, commented-out elements are excluded from the search results.
Variants to search for diagrams, specified as a string or character vector. The default value is
Active. Valid values are:
7-179
7 Classes
Properties of objects to find, specified as a cell array of name-value pairs. The finder returns only
objects that have the specified properties with the specified values.
Example: finder.Properties = {'Gain','5'}
Methods
results = find(finder) finds diagram elements in the diagram specified by the finder. This
method returns the diagram elements it finds wrapped in result objects of type
slreportgen.finder.DiagramElementResult. To add tables of the diagram element properties,
add the results objects directly to the report or add them to a reporter that you then add to a report.
The reports to which you can add the results of this method must be reports of type
slreportgen.report.Report.
tf = hasNext(finder) determines if the diagram that the finder searches contains at least one
element. If the diagram has at least one element, the hasNext method queues that element as the
next element that the next method will return. The hasNext method then returns true. Use the
next method to obtain that element. On subsequent calls, the hasNext method determines if the
diagram has an element that the next method has not yet retrieved. It queues the element for the
next method to retrieve and returns true. If there are no more elements exist to be retrieved, this
method returns false. To search a diagram progressively for elements, use the hasNext method
with the next method in a while loop.
result = next(finder) returns the next search result in the result queue that the hasNext
method created. This method returns the diagram element that it finds wrapped in a result object of
type slreportgen.finder.DiagramElementResult. To add tables of the diagram element
properties, add the results objects directly to the report or add them to a reporter that you then add
to a report. The reports to which you can add the results of this method must be of type
slreportgen.report.Report.
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Examples
Find Block, Annotation, and Line Elements
Find the block, annotation, and line diagram elements to a search depth of 1 in the f14 model.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = 'f14';
load_system(model_name);
rpt = slreportgen.report.Report('output','pdf');
add(rpt, TitlePage("Title",sprintf('%s Model',...
model_name)));
add(rpt, TableOfContents);
7-180
slreportgen.finder.DiagramElementFinder class
while hasNext(diagFinder)
system = next(diagFinder);
chapter = Chapter("Title",system.Name);
add(chapter,system);
sect = Section("Title","Diagram Elements");
elemFinder = DiagramElementFinder("Container", ...
system.Object, "Types",...
["block" "annotation" "line"]);
elems = find(elemFinder);
for elem = elems
add(sect, elem);
end
add(chapter, sect);
add(rpt, chapter);
end
close(rpt);
close_system(model_name);
rptview(rpt);
See Also
slreportgen.report.Report | slreportgen.finder.DiagramFinder |
slreportgen.finder.SystemDiagramFinder | slreportgen.finder.ChartDiagramFinder |
slreportgen.finder.StateflowDiagramElementFinder |
slreportgen.finder.StateFinder | slreportgen.report.Diagram |
slreportgen.finder.BlockFinder | slreportgen.finder.AnnotationFinder |
slreportgen.finder.DiagramElementResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-181
7 Classes
slreportgen.finder.DiagramFinder class
Package: slreportgen.finder
Description
Finds Simulink diagrams and Stateflow charts.
Construction
finder = DiagramFinder(container) creates a finder that finds by default all uncommented
Simulink block diagrams and Stateflow chart diagrams in the specified container. To constrain the
search to include specific types of diagrams, use the properties of this finder.
Note This finder can operate in either find or iterator mode. In find mode, use its find method to
return the results of a search as an array of results. In iterator mode, use its hasNext and next
methods to return the results of a search one-by-one. When searching in models that have many
model references, use iterator mode. Iterator mode closes a model after compiling and searching it,
whereas find mode keeps all the models that it searches open. Having many open models can
consume all system memory and slow report generation. Iterator mode is slower than find mode, so
use find mode to search models that reference few or no other models.
finder = DiagramFinder(Name,Value) sets properties using name-value pairs. You can specify
multiple name-value pair arguments in any order. Enclose each property name in single quotes.
Input Arguments
Properties
Container — Model container to search
path | handle | chart ID | chart object
7-182
slreportgen.finder.DiagramFinder class
Depth of system diagram search, specified as inf or a positive integer. SearchDepth specifies how
many levels deep to search a diagram container for diagrams. To search all levels, use inf.
Choice to search masked subsystems, specified as a logical. If this property is true, the finder
searches masked Subsystem blocks in the diagram container. It searches to the specified
SearchDepth and includes the diagrams it finds in the search results.
Choice to search referenced models, specified as a logical. If this property is true, the finder
searches models referenced in the diagram container. It searches to the specified SearchDepth and
includes the diagrams it finds in the search results.
Choice to search Simulink library links, specified as a logical. If both this property and
IncludeMaskedSubsystems are true, the finder searches links in the diagram container to both
Subsystem and masked Subsystem blocks in Simulink libraries. It searches to the specified
SearchDepth and includes the diagrams it finds in the search results. If this property is true, but
IncludeMaskedSubsystems is false, the finder searches only links to Subsystem blocks in
Simulink libraries.
Choice to search user library links, specified as a logical. If this property is true and the
IncludeMaskedSubsystems property is true, the finder searches links in the diagram container to
Subsystem and masked Subsystem blocks in user libraries. It searches to the specified SearchDepth
and includes the diagrams it finds in the search results. If this property is true, but the
IncludeMaskedSubsystems property is false, the finder searches only links to Subsystem blocks
in user libraries.
Whether to include commented-out diagrams in the search results, specified as a logical. If false,
commented-out diagrams are excluded from the search results.
Variants to search for diagrams, specified as a string or character vector. The default value is
Active. Valid values are:
7-183
7 Classes
Properties of objects to find, specified as a cell array of name-value pairs. The finder returns only
objects that have the specified properties with the specified values.
Example: finder.Properties = {'Gain','5'}
Whether to close models, specified as true or false. If true, the next method of the finder closes
the currently open model before moving to the next model to search. Closing models prevents
excessive consumption of memory when searching a model that references many models.
Note The find method of the finder ignores this property and leaves all referenced models open.
For this reason, you should not use the find method to search models with many model references.
Methods
results = find(finder) finds diagrams in the specified container. The finder is an
slreportgen.finder.DiagramFinder object. results is an array of
slreportgen.finder.DiagramResult objects, each of which contains a diagram found by this
method. Adding this array to a report or a reporter adds images of all the diagrams that it contains.
The reports to which you can add the results of this method are reports of type
slreportgen.report.Report or another reporter object, such as an
slreportgen.report.Chapter reporter.
Note The find method opens and compiles a top-level model and all models it references. This
method leaves all the models open at the conclusion of a search, which can slow reporting on models
that contain many model references. To avoid this slowdown, use the hasNext and next methods to
search such a model.
tf = hasNext(finder) determines if the container that the finder searches contains at least one
diagram. If the container has at least one diagram, the hasNext method queues that diagram as the
next diagram that the next method will return. The hasNext method then returns true. Use the
next method to obtain that diagram. On subsequent calls, the hasNext method determines if the
container has a diagram that the next has not yet retrieved. It queues the diagram for the next
method to retrieve and returns true. If there are no more diagrams to be retrieved, this method
returns false. To search a container progressively for diagrams, use the hasNext method with the
next method in a while loop.
Note If the current result is the last result in the search queue for the current model and the
AutoCloseModel property is true, this method closes the current model before it opens the next
model. Although this increases search time, it reduces memory consumption when searching a top
model that references many other models. If your model does not reference many other models, to
speed up the search, set the AutoCloseModel property to false or use the find method.
7-184
slreportgen.finder.DiagramFinder class
result = next(finder) returns the next search result in the result queue that the hasNext
method created. The search result contains the resulting diagram. Adding this result object to a
report or reporter adds a Diagram reporter for the diagram.
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Examples
Find All Block Diagrams and Stateflow Charts
Create a report that includes an image of all diagrams in the slrgex_sf_car model. Although the
model used in this example does not contain model references, the example uses iterator mode to
illustrate its syntax.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = 'slrgex_sf_car';
load_system(model_name);
rpt = slreportgen.report.Report('output','pdf');
add(rpt, TitlePage('Title', sprintf('%s Systems',...
model_name)));
finder = DiagramFinder(model_name);
while hasNext(finder)
add(rpt,next(finder));
end
close(rpt);
close_system(model_name);
rptview(rpt);
Open the slrgex_sf_car model and find all the diagrams in its Engine subsystem. Use either the
path to the subsystem or its handle. You can then include the results in your report.
slrgex_sf_car
% Use path
enginePath = "slrgex_sf_car/Engine";
finder = slreportgen.finder.DiagramFinder(enginePath);
results = find(finder);
% or use handle
engineHandle = get_param("slrgex_sf_car/Engine","Handle");
finder = slreportgen.finder.DiagramFinder(engineHandle);
results_enginehandle = find(finder);
7-185
7 Classes
model = 'f14';
load_system(model);
finder = slreportgen.finder.DiagramElementFinder(model)
finder.Properties = {'Gain','Zw'};
results = find(finder);
See Also
slreportgen.report.Report | slreportgen.finder.DiagramElementFinder |
slreportgen.finder.SystemDiagramFinder | slreportgen.finder.ChartDiagramFinder |
slreportgen.finder.StateflowDiagramElementFinder | slreportgen.report.Diagram |
slreportgen.finder.DiagramResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-186
slreportgen.finder.DiagramElementResult class
slreportgen.finder.DiagramElementResult class
Package: slreportgen.finder
Description
Diagram element search result object for an element in a Simulink or Stateflow diagram.
Construction
result = DiagramElementResult(elem) creates a search result object for a diagram element.
The result object contains the specified Simulink or Stateflow diagram element.
Note The find methods of diagram element finders create and return instances of this
slreportgen.finder.DiagramElementResult object. You do not need to create instances
yourself.
Input Arguments
Properties
Object — Diagram element handle
handle
This read-only property contains a handle to the diagram element returned in this result.
This read-only property specifies the name of the diagram element returned in this result.
This read-only property specifies the type of the diagram element returned in this result.
Example: "Simulink.BlockDiagram"
7-187
7 Classes
This read-only property returns the path of the diagram that contains the element returned in this
result.
Additional information to add to this result. You can set it to any type of value.
Methods
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Examples
The slrgex_sf_car model uses a Simulink Function, which is a function that uses a Simulink
subsystem to compute its outputs from its inputs. This example finds the diagrams in the model and
for each diagram uses an slreportgen.DiagramElementFinder object to find the Simulink
Function subsystems. For each slreportgen.DiagramElementResult object returned by the
finder, the example uses the Name property value as a section title and calls the
getDiagramReporter method to return the subsystem diagram to add to the section.
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.report.*
model = "slrgex_sf_car";
load_system(model);
rpt = slreportgen.report.Report("output","pdf");
chapter = Chapter();
chapter.Title = "Diagram Element Result Example";
7-188
slreportgen.finder.DiagramElementResult class
end
add(rpt,chapter);
close(rpt);
rptview(rpt);
See Also
slreportgen.report.Report | slreportgen.finder.DiagramElementFinder
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-189
7 Classes
slreportgen.finder.DiagramResult class
Package: slreportgen.finder
Description
Diagram search result object for a Simulink or Stateflow diagram.
finder = DiagramResult(Name,Value) sets properties using name-value pairs. You can specify
multiple name-value pair arguments in any order. Enclose each property name in single quotes.
Construction
result = DiagramResult(diagram) creates a search result object for a Simulink or Stateflow
diagram. The result object contains the specified Simulink or Stateflow diagram. Diagram finder
find methods create and return instances of this object for each diagram that they find. You do not
need to create this object yourself.
Input Arguments
Properties
Object — Diagram handle
handle
This read-only property contains a handle to the diagram returned by this result.
This read-only property specifies the name of the model or block that contains the diagram returned
by this result.
This read-only property specifies the type of the diagram returned by this result.
Example: "Simulink.BlockDiagram"
This read-only property returns the path of the container of the diagram returned by this result. An
example of a container of a diagram is a subsystem block.
7-190
slreportgen.finder.DiagramResult class
Example: "slrgex_sf_car/Engine"
Additional information to add to this result. You can set it to any type of value.
Methods
getReporter Get diagram reporter
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
See Also
slreportgen.finder.ChartDiagramFinder | slreportgen.finder.DiagramFinder |
slreportgen.report.Diagram | slreportgen.report.Report
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-191
7 Classes
slreportgen.finder.ModelVariableFinder class
Package: slreportgen.finder slreportgen.finder slreportgen.finder
slreportgen.finder
Superclasses: mlreportgen.finder.Finder
Description
Find variables used by a Simulink model.
Class Attributes
HandleCompatible true
Creation
Description
1 To return the search results as an array, use the find method. Add the results directly to a
report or process the results in a for loop.
2 To iterate through the results one at a time, use the hasNext and next methods in a while loop.
Properties
Container — Model or subsystem to search
string scalar | character vector | handle
Model or subsystem to search, specified as a string scalar or character vector that contains the path
to the model or subsystem, or as a handle to the model or subsystem.
7-192
slreportgen.finder.ModelVariableFinder class
Regular expression matching, specified as "off" or "on". If Regexp is "off", regular expression
matching is not enabled. If Regexp is "on", regular expression matching is enabled for the values of
the Name, SourceType, and Users properties. For example, this code finds variables that start with
vehicle.
finder = slreportgen.finder.ModelVariableFinder('slrgex_sf_car');
finder.Regexp = "on";
finder.Name = "^vehicle";
Value Description
"compiled" Get up-to-date results by compiling models before
the search. (default)
"cached" Get results more quickly by using data cached
during the previous compilation.
Whether to search for variables in referenced models, specified as one of the values in the table.
Value Description
"on" Search for variables in referenced models.
(default)
"off" Do not search for variables in referenced models.
Name of variable to search for, specified as a character vector or string scalar. If the Regexp property
is set to "on", the value of Name can be a regular expression. If the Name property is empty, the
finder does not search based on the variable name.
Example: "vehicledata"
Example: "^vehicle"
7-193
7 Classes
If you set SourceType, the finder returns variables only from the specified source. If the Regexp
property is set to "on", the value of SourceType can be a regular expression. If the SourceType
property is empty, the finder does not filter the search results by the source.
Example: finder.SourceType = "model workspace" returns all variables defined in the model
workspace.
Example: finder.SourceType = "(base|mask) workspace" returns all variables defined in the
base workspace or the mask workspace if the Regexp property is set to "On".
Example: finder.SourceType = "\w* workspace" returns all variables defined in the base,
mask, or model workspace if the Regexp property is set to "On".
Names of blocks to search for variables. Specify one block as a character vector or string scalar.
Specify multiple blocks as an array of character vectors or a string array. The finder returns variables
used by one or more of the specified blocks. If you do not set the Users property, the finder searches
the entire model or subsystem. If the Regexp property is set to true, you can set the Users property
to a regular expression.
For example, to find all variables in MyModel that are used by either the Gain1 block or the Gain2
block, you can specify both blocks in the Users property.
Alternatively, you can use a regular expression that matches both block names.
myFinder.Regexp = "on";
myFinder.Users = "Gain(1|2)";
Whether to search for variables in masked subsystems, specified as one of the values in the table.
Value Description
"all" Search for variables in masked subsystems.
(default)
"none" Do not search for variables in masked
subsystems.
Whether to follow library links when searching for variables, specified as one of the values in the
table.
Value Description
"on" Follow links into library blocks. Library links are
treated as subsystems. (default)
"off" Do not follow links into library blocks. Library
links are treated as blocks.
7-194
slreportgen.finder.ModelVariableFinder class
Whether to include variables of inactive variant systems, specified as one of the values in the table.
Value Description
"off" Do not include variables used by inactive variant
systems. (default)
"on" Include variables used by inactive variant
systems. Variables in inactive variants are only
found if the Variant activation time
configuration parameter of the containing Variant
Subsystem or Variant Model block is set to code
compile or update diagram analyze all
choices. To include variables in Model blocks
that are inactive systems, the
SearchReferencedModels property of this
finder must also be set to "on".
Methods
Public Methods
7-195
7 Classes
Examples
Find the variables in a model and add the results directly to a report. Specify that the finder includes
variables in masked systems.
% Create a Chapter
chapter = mlreportgen.report.Chapter();
chapter.Title = "Model Variable Finder Example";
7-196
slreportgen.finder.ModelVariableFinder class
Customize the formatting of model variables in a report by iterating through the search results and
setting properties of the model variable reporter for each result.
% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");
% Create a Chapter
chapter = mlreportgen.report.Chapter();
chapter.Title = "Model Variable Reporter Example";
while hasNext(finder)
result = next(finder);
See Also
slreportgen.report.BusObject | Simulink.findVars | Simulink.VariableUsage |
slreportgen.finder.ModelVariableResult | slreportgen.report.ModelVariable
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
7-197
7 Classes
slreportgen.finder.ModelVariableResult class
Package: slreportgen.finder
Description
Model variable search result object for a variable used in a Simulink model or subsystem.
Class Attributes
HandleCompatible true
Creation
You do not create an slreportgen.finder.ModelVariableResult object explicitly. The
slreportgen.finder.ModelVariableFinder find or next methods create an
slreportgen.finder.ModelVariableResult object for each variable that is found.
Properties
Object — Simulink.VariableUsage object
Simulink.VariableUsage object
Simulink.VariableUsage object for the variable represented by this result. This property is read-
only.
Name of the variable represented by this result, specified as a character vector. This property is read-
only.
Source of the variable definition, specified as a character vector. This property is read-only. This table
shows example values.
Value Description
'base workspace' MATLAB base workspace
'MyModel' Model workspace for MyModel
'MyModel/Mask1' Mask workspace for a masked block
7-198
slreportgen.finder.ModelVariableResult class
Value Description
'my_data_dictionary.sldd' The data dictionary
my_data_dictionary.sldd.
Type of the workspace that defines the variable, specified as one of these character vectors:
Blocks that use the variable, specified as a cell array of character vectors. This property is read-only.
Path of the Model block that set the variable value, specified as a character vector. This property is
read-only.
Suppose that a referenced model uses a model argument to set a block parameter value. If a model
has multiple instances of the referenced model, the model variable finder returns multiple instances
of the variable that is associated with the model argument. The ModelBlockPath property uniquely
identifies the instance of the variable by providing the path to the Model block that set its value. If a
variable is not associated with a model argument in a referenced model, the ModelBlockPath is
empty. For more information about referenced models and instance-specific parameters, see
“Parameterize Instances of a Reusable Referenced Model”.
Additional information to save with this result. You can set it to any type of value.
Methods
Public Methods
getReporter Get reporter for model variable search result
getVariableID Get unique ID of model variable
getVariableValue Get value of variable from model variable search result
Examples
Customize the formatting of model variables in a report by iterating through the search results and
setting properties of the model variable reporter for each result.
% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");
7-199
7 Classes
% Create a Chapter
chapter = mlreportgen.report.Chapter();
chapter.Title = "Model Variable Reporter Example";
while hasNext(finder)
result = next(finder);
See Also
slreportgen.finder.ModelVariableFinder | slreportgen.report.ModelVariable |
Simulink.VariableUsage
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
7-200
slreportgen.finder.SignalFinder class
slreportgen.finder.SignalFinder class
Package: slreportgen.finder slreportgen.finder slreportgen.finder
slreportgen.finder
Description
Use an object of the slreportgen.finder.SignalFinder class to find signals used by a model or
block.
Signals are the outputs of dynamic systems that are represented by blocks in a Simulink diagram and
by the diagram itself. To find unique signals in a system, the signal finder searches for block output
ports. When a block or subsystem is searched, the results represent the output ports of the block or
subsystem, as well as the output ports of the blocks whose output signals feed into the block or
subsystem. When a model is searched, the results represent the output ports of the model Inport
blocks and the block output ports that are connected to the model Outport blocks.
Class Attributes
HandleCompatible true
Creation
Description
• Constrain the search to the types of signals found, such as input, output, or internal signals.
• Specify the number of levels to search in a model.
1 To return the search results as an array, use the find method. Add the results directly to a
report or process the results in a for loop.
2 To iterate through the results one at a time, use the hasNext and next methods in a while loop.
7-201
7 Classes
Properties
Container — Model or block to search for signals
string scalar | character vector | handle | slreportgen.finder.DiagramResult object |
slreportgen.finder.BlockResult object
Model or block to search for signals, specified as one of the following values:
Whether to find the signals used as input data to the container model or block, specified as true or
false. If Container is a model, the input signal results represent the output ports of any Inport
blocks in the top level of the model. If Container is a block, the input signal results represent the
output ports of the blocks that feed into the container block input ports.
Whether to find signals output by the container model or block, specified as true or false. If
Container is a model, the output signal results represent the output ports of blocks that feed into
Outport blocks in the top level of the model. If Container is a block, the output signal results
represent the output ports of the block.
Whether to find block control signals, specified as true or false. This property applies only when
Container is a block, such as a Subsystem or Model block, that has a control port. Control signals
control the execution of a block. Control signal results represent the output ports of blocks that feed
into a block control port, such as the enable, trigger, or reset port. If Container is a model, any
signals that control the execution of blocks in the model are reported as internal signals.
Whether to find internal signals, specified as true or false. Internal signals are not used as input,
output, or control signals for a model or subsystem. This property applies only if the Container is a
model or subsystem. Internal signal results represent the output ports of all blocks in the system,
except for the output ports of Inport blocks and output ports that feed into Outport blocks.
If this property is true, signal results can represent ports of virtual blocks, such as virtual Subsystem
blocks.
7-202
slreportgen.finder.SignalFinder class
If this property is false, signal results represent only output ports of nonvirtual blocks. Input and
control signals are traced to the nonvirtual blocks that output the signal. If the model or block
specified by the Container property is virtual, output ports of the model or block are traced to their
nonvirtual sources.
Number of levels to search for internal signals in the model or subsystem, specified as one of these
values:
See IncludeInternalSignals.
Properties of output ports to find, specified as a cell array of name-value pairs. The finder returns
only output ports that have the specified properties with the specified values.
Example: {'CompiledPortDataType','int8'}
Methods
Public Methods
7-203
7 Classes
Examples
This example creates a report that includes information about signals in a model by using an
slreportgen.finder.SignalFinder object. The example sets the finder properties so that
signals without names are excluded and internal signals are included.
Import the MATLAB Report API and Simulink Finder API packages so that you do not have to use
long, fully qualified class names.
import mlreportgen.report.*
import slreportgen.finder.*
rpt = slreportgen.report.Report("MyReport","pdf");
chapter = Chapter();
chapter.Title = "Named Signals";
Load a model.
model_name = "slrgex_vdp";
load_system(model_name);
Create a signal finder and set the properties to exclude signals without names and include internal
signals.
7-204
slreportgen.finder.SignalFinder class
finder = SignalFinder(model_name);
finder.IncludeUnnamedSignals = false;
finder.IncludeInternalSignals = true;
results = find(finder);
append(chapter,results);
append(rpt,chapter);
close(rpt);
rptview(rpt);
See Also
slreportgen.report.BusObject | slreportgen.finder.DiagramResult |
slreportgen.finder.BlockResult | slreportgen.finder.SignalResult |
slreportgen.report.Signal
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
“Signal Basics”
Introduced in R2021a
7-205
7 Classes
slreportgen.finder.SignalResult class
Package: slreportgen.finder slreportgen.finder slreportgen.finder
slreportgen.finder
Description
An object of the slreportgen.finder.SignalResult class represents a result of a search for the
signals used by a model or block. You can append a SignalResult object directly to a report.
Alternatively, you can use the getReporter method to access the slreportgen.report.Signal
reporter for the result and then customize the reporter and append it to the report.
Class Attributes
HandleCompatible true
Creation
You do not create an slreportgen.finder.SignalResult object explicitly. The
slreportgen.finder.SignalFinder find and next methods create an
slreportgen.finder.SignalResult object for each signal that is found.
Properties
Object — Block output port
handle
Block output port that represents the found signal, specified as a handle. This property is read-only.
Name of the found signal, specified as a string scalar. This property is read-only.
Name of the block that is the source of the found signal, specified as a string scalar. This property is
read-only.
Number of the output port that represents the found signal, specified as an integer. This property is
read-only.
7-206
slreportgen.finder.SignalResult class
Name of model or block that uses this signal, specified as a string scalar. The value of this property
corresponds to the value of the Container property of the slreportgen.finder.SignalFinder
object used to find this signal. This property is read-only.
Relationship of the found signal to the container model or block, specified as "Input", "Output",
"Internal", "Control", or "State". The container model or block is specified by the
RelatedObject property.
Methods
Public Methods
Examples
7-207
7 Classes
Import the MATLAB and Simulink Report API packages so that you do not have to use long, fully
qualified class names.
import mlreportgen.report.*
import slreportgen.report.*
rpt = slreportgen.report.Report("MySignalReport","pdf");
chapter = mlreportgen.report.Chapter();
chapter.Title = "Signals";
Load a model.
model_name = "slrgex_vdp";
load_system(model_name);
finder = slreportgen.finder.SignalFinder(model_name);
Find the signals. For each found signal, get the reporter, specify that you want to report empty
property values, and add the reporter to the chapter.
while hasNext(finder)
result = next(finder);
reporter = getReporter(result);
reporter.ShowEmptyValues = true;
add(chapter,reporter);
end
add(rpt,chapter);
close(rpt);
rptview(rpt);
See Also
slreportgen.finder.SignalFinder | slreportgen.report.Signal
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
7-208
slreportgen.finder.SignalResult class
“Signal Basics”
Introduced in R2021a
7-209
7 Classes
slreportgen.finder.StateFinder class
Package: slreportgen.finder
Description
Finds Stateflow states.
Construction
finder = StateFinder(diagram) creates a finder that finds by default all uncommented
Stateflow states in the specified chart diagram. To constrain the search to specific types of chart
diagrams, use the properties of this finder.
1 To return the search results as an array, use the find method. Add the results directly to a
report or process the results in a for loop.
2 To iterate through the results one at a time, use the hasNext and next methods in a while loop.
finder = StateFinder(Name,Value) sets properties using name-value pairs. You can specify
multiple name-value pair arguments in any order. Enclose each property name in single quotes.
Input Arguments
Properties
Container — Chart diagram to search
path | handle | chart ID | chart object
7-210
slreportgen.finder.StateFinder class
Choice to include commented-out states in the search results, specified as a logical. If false,
commented-out states are excluded from the search results.
Properties of states to find, specified as a cell array of name-value pairs. The finder returns only
states that have the specified properties with the specified values.
Example: finder.Properties = {'ArrowSize','5'}
Methods
results = find(finder) finds states in the chart diagram specified by the finder. This method
returns the states it finds wrapped in result objects of type
slreportgen.finder.DiagramElementResult. To add tables of the state properties, add the
results objects directly to the report or add them to a reporter that you then add to a report. The
reports to which you can add the results of this method must be reports of type
slreportgen.report.Report.
tf = hasNext(finder) determines if the chart diagram that the finder searches contains at least
one state. If the chart diagram has at least one state, the hasNext method queues that state as the
next state that the next method will return. The hasNext method then returns true. Use the next
method to obtain that state. On subsequent calls, the hasNext method determines if the chart
diagram has a state that the next method has not yet retrieved. It queues the state for the next
method to retrieve and returns true. If there are no more states to be retrieved, this method returns
false. To search a chart diagram progressively for states, use the hasNext method with the next
method in a while loop.
result = next(finder) returns the next search result in the result queue that the hasNext
method created. This method returns the state that it finds wrapped in a result object of type
slreportgen.finder.DiagramElementResult. To add tables of the state properties, add the
results objects directly to the report or add them to a reporter that you then add to a report. The
reports to which you can add the results of this method must be of type
slreportgen.report.Report.
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Examples
Find Stateflow States
Create a report that includes properties of all the Stateflow states in the shift_logic chart of the
slrgex_sf_car model.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = "slrgex_sf_car";
load_system(model_name);
7-211
7 Classes
rpt = slreportgen.report.Report("output","pdf");
open(rpt)
add(rpt, TitlePage("Title",...
sprintf('States in %s Model',model_name)));
add(rpt, TableOfContents);
chartFinder = ChartDiagramFinder(model_name);
charts = find(chartFinder);
while hasNext(chartFinder)
diagram = next(chartFinder);
stFinder = StateFinder(diagram.Object);
states = find(stFinder);
if ~isempty(states)
chapter = Chapter("Title",diagram.Name);
add(chapter,diagram)
for state = states
sect = Section("Title","States");
add(sect,states)
end
add(chapter,sect)
add(rpt,chapter)
end
end
close(rpt)
close_system(model_name)
rptview(rpt)
See Also
slreportgen.report.Report | slreportgen.finder.DiagramElementFinder |
slreportgen.finder.ChartDiagramFinder |
slreportgen.finder.StateflowDiagramElementFinder |
slreportgen.report.StateflowObjectProperties |
slreportgen.finder.DiagramElementResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-212
slreportgen.finder.StateflowDiagramElementFinder class
slreportgen.finder.StateflowDiagramElementFinde
r class
Package: slreportgen.finder
Description
StateflowDiagramElementFinder creates a finder object that finds elements in a Stateflow chart
diagram.
Construction
finder = StateflowDiagramElementFinder(diagram) creates a finder that finds elements of a
Stateflow chart diagram. By default this finder finds states, transitions, truth tables, and other
elements in the specified Stateflow chart diagram. Use the properties of the finder to constrain the
search to specific types of elements.
1 To return the search results as an array, use the find method. Add the results directly to a
report or process the results in a for loop.
2 To iterate through the results one at a time, use the hasNext and next methods in a while loop.
Input Arguments
Properties
Container — Chart diagram to search
path | handle | chart ID | chart object
7-213
7 Classes
• Stateflow chart ID
• Stateflow chart object
Types of Stateflow diagram elements to find, specified as a string, character array, array of strings, or
a cell array of character arrays. If the type is an array, it specifies a set of element types. The default
is All or all, which finds all elements in all diagrams. Use one of these values to constrain the
search to specific diagram element types. You can use either the fully qualified name or the short
name.
Whether to include commented-out chart elements in the search results, specified as a logical. If
false, commented-out elements are excluded from the search results.
Properties of objects to find, specified as a cell array of name-value pairs. The finder returns only
elements that have the specified properties with the specified values.
Example: finder.Properties = {'ArrowSize','5'}
Methods
results = find(finder) finds Stateflow chart diagram elements in the diagram specified by the
finder. This method returns the chart diagram elements it finds wrapped in result objects of type
slreportgen.finder.DiagramElementResult. To add tables of the chart diagram element
properties, add the results objects directly to the report or add them to a reporter that you then add
to a report. The reports to which you can add the results of this method must be reports of type
slreportgen.report.Report.
tf = hasNext(finder) determines if the chart diagram that the finder searches contains at least
one element. If the chart diagram has at least one element, the hasNext method queues that element
7-214
slreportgen.finder.StateflowDiagramElementFinder class
as the next element that the next method will return. The hasNext method then returns true. Use
the next method to obtain that element. On subsequent calls, the hasNext method determines if the
chart diagram has an element that the next method has not yet retrieved. It queues the element for
the next method to retrieve and returns true. If there are no more elements to be retrieved, this
method returns false. To search a chart diagram progressively for elements, use the hasNext
method with the next method in a while loop.
result = next(finder) returns the next search result in the result queue that the hasNext
method created. This method returns the chart diagram element that it finds wrapped in a result
object of type slreportgen.finder.DiagramElementResult. To add tables of the chart diagram
element properties, add the results objects directly to the report or add them to a reporter that you
then add to a report. The reports to which you can add the results of this method must be of type
slreportgen.report.Report.
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Examples
Find Stateflow States and Transitions
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = "slrgex_fuelsys_fuel_rate_control";
load_system(model_name)
rpt = slreportgen.report.Report("output","pdf");
add(rpt, TitlePage("Title",sprintf("%s Charts",...
model_name)))
add(rpt, TableOfContents)
chartFinder = ChartDiagramFinder(model_name);
while hasNext(chartFinder)
chart = next(chartFinder);
chapter = Chapter("Title",chart.Name);
add(chapter, chart)
sect = Section("Title","States");
stateFinder = StateFinder(chart.Object);
states = find(stateFinder);
for state = states
add(sect,state)
end
add(chapter,sect)
sect = Section("Title","Transitions");
transitionFinder = StateflowDiagramElementFinder...
("Container",chart.Object,"Types","transition");
transitions = find(transitionFinder);
for transition = transitions
add(sect,transition)
7-215
7 Classes
end
add(chapter,sect)
add(rpt, chapter)
end
close(rpt);
close_system(model_name);
rptview(rpt)
See Also
slreportgen.report.Report | slreportgen.finder.ChartDiagramFinder |
slreportgen.finder.StateFinder | slreportgen.report.StateflowObjectProperties |
slreportgen.report.Diagram | slreportgen.finder.AnnotationFinder |
slreportgen.finder.DiagramElementResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-216
slreportgen.finder.SystemDiagramFinder class
slreportgen.finder.SystemDiagramFinder class
Package: slreportgen.finder
Description
Create Simulink block diagram finder.
Construction
finder = SystemDiagramFinder(container) creates a finder that finds by default all
uncommented Simulink block diagrams in the specified container, which can be a Simulink model or
subsystem. To constrain the search to specific types of models or subsystems, use the properties of
the finder.
Note This finder can operate in either find or iterator mode. In find mode, use its find method to
return the results of a search as an array of results. In iterator mode, use its hasNext and next
methods to return the results of a search one-by-one. When searching in models that have many
model references, use iterator mode. Iterator mode closes a model after compiling and searching it,
whereas find mode keeps all the models that it searches open. Having many open models can
consume all system memory and slow report generation. Iterator mode is slower than find mode, so
use find mode to search models that reference few or no other models.
Input Arguments
Properties
Container — Diagram container to search
path | handle | chart ID | chart object
7-217
7 Classes
Depth of system diagram search, specified as inf or a positive integer. SearchDepth specifies how
many levels deep to search a diagram container for diagrams. To search all levels, use inf.
Choice to search masked subsystems, specified as a logical. If this property is true, the finder
searches masked Subsystem blocks in the diagram container. It searches to the specified
SearchDepth and includes the diagrams it finds in the search results.
Choice to search referenced models, specified as a logical. If this property is true, the finder
searches models referenced in the diagram container. It searches to the specified SearchDepth and
includes the diagrams it finds in the search results.
Choice to search Simulink library links, specified as a logical. If both this property and
IncludeMaskedSubsystems are true, the finder searches links in the diagram container to both
Subsystem and masked Subsystem blocks in Simulink libraries. It searches to the specified
SearchDepth and includes the diagrams it finds in the search results. If this property is true, but
IncludeMaskedSubsystems is false, the finder searches only links to Subsystem blocks in
Simulink libraries.
Choice to search user library links, specified as a logical. If this property is true and the
IncludeMaskedSubsystems property is true, the finder searches links in the diagram container to
Subsystem and masked Subsystem blocks in user libraries. It searches to the specified SearchDepth
and includes the diagrams it finds in the search results. If this property is true, but the
IncludeMaskedSubsystems property is false, the finder searches only links to Subsystem blocks
in user libraries.
Choice to include the root diagram in the search results, specified as a logical. If true and the top-
level diagram container is a model, the model block diagram is included in the search results.
Otherwise, the search results omit the model block diagram.
Choice to include commented-out diagrams in the search results, specified as a logical. If false,
commented-out diagrams are excluded from the search results.
Variants to search for diagrams, specified as a string or character vector. The default value is
Active. Valid values are:
7-218
slreportgen.finder.SystemDiagramFinder class
Properties of objects to find, specified as a cell array of name-value pairs. The finder returns only
objects that have the specified properties with the specified values.
Example: finder.Properties = {'Gain','5'}
Whether to close models, specified as true or false. If true, the next method of the finder closes
the currently open model before moving to the next model to search. Closing models prevents
excessive consumption of memory when searching a model that references many models.
Note The find method of the finder ignores this property and leaves all referenced models open.
For this reason, you should not use the find method to search models with many model references.
Methods
results = find(finder) finds block diagrams in the container specified by the finder. The
finder is an slreportgen.finder.SystemDiagramFinder object. results is an array of
slreportgen.finder.DiagramResult objects, each of which contains a block diagram found by
this method. Adding the array to a report or reporter adds images of all the block diagrams it
contains. The reports to which you can add the results of this method are reports of type
slreportgen.report.Report or another reporter object, such as an
slreportgen.report.Chapter reporter.
tf = hasNext(finder) determines if the container that the finder searches contains at least one
diagram. If the container has at least one diagram, the hasNext method queues that diagram as the
next diagram that the next method will return. The hasNext method then returns true. Use the
next method to obtain that diagram. On subsequent calls, the hasNext method determines if the
container has a diagram that the next has not yet retrieved. It queues the diagram for the next
method to retrieve and returns true. If there are no more diagrams to be retrieved, this method
returns false. To search a container progressively for diagrams, use the hasNext method with the
next method in a while loop.
Note If the current result is the last result in the search queue for the current model and the
AutoCloseModel property is true, this method closes the current model before it opens the next
model. Although this increases search time, it reduces memory consumption when searching a top
model that references many other models. If your model does not reference many other models, to
speed up the search, set the AutoCloseModel property to false or use the find method.
result = next(finder) returns the next search result in the result queue that the hasNext
method created. The search result contains the resulting diagram. Adding this result object to a
report or reporter adds a Diagram reporter for the diagram.
7-219
7 Classes
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Examples
Find Block Diagrams
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = 'slrgex_sf_car';
load_system(model_name);
rpt = slreportgen.report.Report('output','pdf');
add(rpt, TitlePage('Title', sprintf('%s Systems',...
model_name)));
add(rpt,TableOfContents);
finder = SystemDiagramFinder(model_name);
results = find(finder);
for result = results
chapter = Chapter('Title',result.Name);
add(chapter,result);
add(rpt,chapter);
end
close(rpt);
close_system(model_name);
rptview(rpt);
See Also
slreportgen.report.Report | slreportgen.finder.DiagramFinder |
slreportgen.finder.DiagramElementFinder |
slreportgen.report.SimulinkObjectProperties | slreportgen.report.Diagram |
slreportgen.finder.DiagramResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2017b
7-220
slreportgen.utils.HierarchyNumber class
slreportgen.utils.HierarchyNumber class
Package: slreportgen.utils
Description
Use an object of the slreportgen.utils.HierarchyNumber class to generate numbers that
represent the positions of subsystems in a model hierarchy. You can use the numbers to label report
elements, such as section titles.
Class Attributes
HandleCompatible true
Creation
Description
If you specify the source as a Simulink model, the HierarchyNumber object uses all the
uncommented Simulink subsystems and Stateflow chart diagrams in the model to generate the model
hierarchy numbers. Otherwise, the object uses the custom subsystem list that you specify. For
example, to generate the hierarchy number of Stateflow chart diagrams in a model, specify a list of
the subsystem paths.
Properties
Source — Model or list of subsystems
string scalar | character vector | handle | string array | cell array
Attributes:
GetAccess public
SetAccess private
7-221
7 Classes
Methods
Public Methods
subsystemPaths spaths =
subsystemPaths(thisHierarchyNumberObj)
returns a string array of the paths of the
subsystems in the system represented by
thisHierarchyNumberObj.
generateHierarchyNumber hNum =
generateHierarchyNumber(thisHierarchyN
umberObj,diagram) returns a multilevel
number that represents the position of the
specified diagram in the system represented by
thisHierarchyNumberObj. Specify diagram
as one of these values:
Examples
modelName = "slrgex_f14";
load_system(modelName);
hierNumberObj = slreportgen.utils.HierarchyNumber(modelName);
hierNumber = generateHierarchyNumber(hierNumberObj,"slrgex_f14/Aircraft Dynamics Model")
hierNumber =
"1.1"
This example generates the hierarchy number for each diagram in a model and uses the number in
the title of the report section that corresponds to the diagram.
7-222
slreportgen.utils.HierarchyNumber class
Import the packages so that you do not have to use long, fully-qualified class names.
import mlreportgen.dom.*;
import mlreportgen.report.*;
import slreportgen.finder.*;
import slreportgen.utils.*;
Load a model.
model = "slrgex_f14";
load_system(model);
rpt = Report("output","pdf");
open(rpt);
mlreportgen.report.Section.number(rpt,false);
toc = TableOfContents();
append(rpt,toc);
finder = DiagramFinder(model);
hierNumberObj = HierarchyNumber(model);
For each found diagram, generate the number that represents the relative position of the diagram in
the model hierarchy. Create a section for the diagram and use the generated number in the title. Turn
off the default section numbering. Append the section to the chapter.
while hasNext(finder)
result = next(finder);
hierNumber = hierNumberObj.generateHierarchyNumber(result.Path);
title = strcat (hierNumber + " " + result.Name);
section = Section(title);
section.Numbered = false;
append(chapter, section);
end
append(rpt,chapter);
close(rpt);
rptview(rpt);
7-223
7 Classes
See Also
mlreportgen.report.Section | mlreportgen.report.Report
Introduced in R2021b
7-224
slreportgen.webview.ExportOptions class
slreportgen.webview.ExportOptions class
Package: slreportgen.webview
Description
Use an slreportgen.webview.ExportOptions object to specify the items to export to a web view
or an embedded web view report.
Construction
exportopts = slreportgen.webview.ExportOptions(wvdoc) creates an export options
object, exportopts, for the wvdoc web view or embedded web view document. wvdoc is created
using slreportgen.webview.WebViewDocument or
slreportgen.webview.EmbeddedWebViewDocument. When you create a Web view or embedded
Web view document, an export options object is created automatically.
Input Arguments
Web view document, specified as a Web view or embedded Web view object.
Output Arguments
Export options, returned as a class containing properties that specify what to export to a web view
document.
Properties
Diagrams — Diagram or diagrams to export to the web view
character vector
Diagram on page 7-226 or diagrams to export to the web view, specified as a character vector.
• Current and Below — Current specified system or subsystem and all of its dependents.
• Current — Current specified system or subsystem
• Current and Above — Current specified system or subsystem and all of its antecedents
7-225
7 Classes
Function to determine whether to export a system and its descendants, specified as a function name
or function handle. The function must return True to include the system or False to exclude the
system.
More About
Diagram
See Also
slreportgen.webview.WebViewDocument |
slreportgen.webview.EmbeddedWebViewDocument | slwebview
Introduced in R2017a
7-226
slreportgen.webview.WebViewDocument class
slreportgen.webview.WebViewDocument class
Package: slreportgen.webview
Description
Creates a document generator that generates an HTML document containing a web view of one or
more Simulink models.
Construction
wvdocgen = slreportgen.webview.WebViewDocument(docname,model) creates a document
generator that generates an HTML document at the specified location containing a web view of the
specified model. Use the generator’s fill method to generate the document.
wvdocgen = slreportgen.webview.WebViewDocument(docname,model1,model2,...
modeln)creates a document generator that includes two or more models in the web view that it
creates. This constructor assigns an array of default slreportgen.webview.ExportOptions
objects to the generator’s ExportOptions property, one for each of the models to be included in the
generated document’s web view. You can use the objects to specify custom export options for the
models to be exported.
wvdocgen = slreportgen.webview.WebViewDocument(docname,{model1,model2,...
modeln}) assigns a default slreportgen.webview.ExportOptions object to the generator’s
ExportOptions property that applies to all of the models to be exported.
Input Arguments
docname — Name of output document file and folder
character vector
Name of the zip file and/or folder containing the report generated by this generator. Use this
generator’s PackageType property to specify whether to package the generated report as a file or a
folder or both. If you specify an extension, the extension must be.htmx. If you do not specify an
extension, the report generator appends .htmx.
Name of the Simulink model to export to an interactive HTML Web view, specified as a character
vector.
7-227
7 Classes
Output Arguments
wvdoc — Web view document generator
slreportgen.Web view.WebViewDocument object
Properties
CurrentHoldID — Identifier of current hole in document
character vector
Whether to overwrite an existing report with the same name. True overwrites the existing report.
False generates the report under a new name.
Packaging to use for output document, specified as one of these character vectors:
Path to the HTML template to use to generate this report. The template has an .htmtx extension.
This property points by default to a default template. To use a custom template, set this property to
the path of the custom template.
7-228
slreportgen.webview.WebViewDocument class
Text to display in the title bar of the HTML browser displaying the generated web view document.
The default text is “Simulink Web View - Created by Simulink Report Generator."
Methods
Method Purpose
fill Invokes web view generator’s hole-filling
methods (e.g., fillslwebview) to fill the holes in
the web view document’s template
fillslwebview Fills template’s slwebview hole with a web view
getExportModels Names of models to be included in the web view
getExportDiagrams Paths and handles of block diagrams to be
included in the web view
getExportSimulinkSubSystems Paths and handles of subsystem blocks to be
included in this web view
getExportStateflowCharts Paths and handles of
getExportStateflowDiagrams Array of Stateflow diagram paths
Examples
Export Model to a Web View
import slreportgen.webview.*
open_system('f14')
d = WebViewDocument('f14WebView', 'f14');
fill(d);
rptview(d);
The export options in this example allow you to view the subsystem that implements the Simulink
library block, Band-Limited White Noise, in the f14 model and the Stateflow chart that implements
the Engine block in the slrgex_sf_car model. If the example did not enable the export options,
the subsystem and chart would appear only as blocks in the exported web view.
import slreportgen.webview.*
open_system('f14');
open_system('slrgex_sf_car');
wvdoc = WebViewDocument(...
'myWebview','f14','slrgex_sf_car');
opts = wvdoc.ExportOptions;
f14Opts = opts(1);
f14Opts.IncludeMaskedSubsystems = true;
f14Opts.IncludeSimulinkLibraryLinks = true;
sfcarOpts = opts(2);
sfcarOpts.IncludeMaskedSubsystems = true;
fill(wvdoc)
rptview(wvdoc);
7-229
7 Classes
This example exports f14’s root system and Aircraft Dynamics Model subsystem.
import slreportgen.webview.*
open_system('f14');
wvdoc = WebViewDocument('myWebView', ...
{'f14', 'f14/Aircraft Dynamics Model'});
wvdoc.ExportOptions.SearchScope = 'Current';
fill(wvdoc)
rptview(wvdoc);
import slreportgen.webview.*
open_system('f14');
wvdoc = WebViewDocument(...
'mydoc', 'f14/Controller');
wvdoc.ExportOptions.SearchScope = 'CurrentAndAbove';
fill(wvdoc)
rptview(wvdoc);
See Also
slreportgen.webview.EmbeddedWebViewDocument | slreportgen.webview.ExportOptions
Introduced in R2017a
7-230
8
Functions
8 Functions
getDiagramReporter
Class: slreportgen.finder.BlockResult
Package: slreportgen.finder
Syntax
reporter = getDiagramReporter(result)
Description
reporter = getDiagramReporter(result) returns a diagram reporter if the block result
contains a subsystem or chart block. The reporter generates a snapshot of the block's diagram or
chart, respectively. If the block result contains any other type of block, this method returns empty,
[]. To include a diagram of the subsystem or chart block search result in a report, add this
reporter to the report, either directly or via a Chapter or Section reporter.
Input Arguments
result — Block result object
BlockResult object
Output Arguments
reporter — Diagram reporter object
slreportgen.report.Diagram object | []
Examples
Add Block Diagram to Report
Add a subsystem snapshot and property table of the Controller block subsystem of the f14 model to a
report.
model_name = 'f14';
load_system(model_name)
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.report.*
rpt = slreportgen.report.Report('output','pdf');
chapter = Chapter();
8-2
getDiagramReporter
blkFinder = BlockFinder(model_name);
blocks = find(blkFinder);
for block = blocks
if block.Name == "Controller"
rptr = getDiagramReporter(block);
section = Section("Title", ...
strrep(block.Name, newline,' '));
add(section,rptr);
add(section,block);
add(chapter,section);
end
end
add(rpt,chapter)
rptview(rpt)
8-3
8 Functions
See Also
slreportgen.finder.BlockFinder | slreportgen.report.Diagram
Introduced in R2018b
8-4
getReporter
getReporter
Class: slreportgen.finder.BlockResult
Package: slreportgen.finder
Syntax
reporter = getReporter(blockResult)
Description
reporter = getReporter(blockResult) returns a reporter that generates a properties table for
the block in the result.
Input Arguments
blockResult — Block result object
slreportgen.finder.BlockResult object
Output Arguments
reporter — Simulink object properties reporter
block-specific reporter object | slreportgen.report.SimulinkObjectProperties object
• Block-specific reporter object, when the Report API includes a reporter for the block. For example,
the getReporter method returns an slreportgen.report.DocBlock object when the search
result represents a DocBlock block.
• An slreportgen.report.SimulinkObjectProperties object, when the Report API does not
include a reporter specific to the block. A SimulinkObjectProperties reporter generates a
properties table for the block.
See Also
slreportgen.finder.BlockFinder | slreportgen.report.SimulinkObjectProperties
Introduced in R2017b
8-5
8 Functions
getDiagramReporter
Class: slreportgen.finder.DiagramElementResult
Package: slreportgen.finder
Syntax
reporter = getDiagramReporter(result)
Description
reporter = getDiagramReporter(result) returns a reporter that generates a snapshot of the
element returned in the diagram element result, or empty, []. If the result contains a diagram
element, such as a Simulink block, or Stateflow chart or subchart, that contains a diagram, this
method returns a reporter that generates a snapshot of the diagram. Otherwise, it returns empty, [].
For example, this method returns a diagram reporter for chart and subchart results but [] for state
results, which do not contain diagrams. To include the diagram of an applicable search result in a
report, add this reporter to the report, either directly or via a Chapter or Section reporter.
Input Arguments
result — Diagram element result object
DiagramElementResult object
Output Arguments
reporter — Diagram reporter object
slreportgen.report.Diagram object | []
Examples
The slrgex_sf_car model uses a Simulink Function, which is a function that uses a Simulink
subsystem to compute its outputs from its inputs. This example finds the diagrams in the model and
for each diagram uses an slreportgen.DiagramElementFinder object to find the Simulink
Function subsystems. For each slreportgen.DiagramElementResult object returned by the
finder, the example uses the Name property value as a section title and calls the
getDiagramReporter method to return the subsystem diagram to add to the section.
8-6
getDiagramReporter
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.report.*
model = "slrgex_sf_car";
load_system(model);
rpt = slreportgen.report.Report("output","pdf");
chapter = Chapter();
chapter.Title = "Diagram Element Result Example";
add(rpt,chapter);
close(rpt);
rptview(rpt);
8-7
8 Functions
See Also
slreportgen.finder.DiagramElementFinder | slreportgen.report.Diagram
Introduced in R2018b
8-8
getReporter
getReporter
Class: slreportgen.finder.DiagramElementResult
Package: slreportgen.finder
Syntax
reporter = getReporter(result)
Description
reporter = getReporter(result) returns a reporter that generates a properties table for the
diagram element returned in this result. A report or reporter to which a diagram element result is
added invokes this method to generate a properties table for the element in the result. If you need to
customize a properties table, you can invoke this method to get the properties reporter. Then, modify
the reporter and add the modified properties reporter to the target report or reporter.
Input Arguments
result — Diagram element result object
slreportgen.finder.DiagramElementResult object
Output Arguments
reporter — Diagram element reporter object
block-specific reporter object | slreportgen.report.SimulinkObjectProperties object |
slreportgen.report.StateflowObjectProperties object
• Block-specific reporter object, when the diagram element is a block and the Report API includes a
reporter for the block. For example, the getReporter method returns an
slreportgen.report.DocBlock object when the search result represents a DocBlock block.
• An slreportgen.report.SimulinkObjectProperties object for all other blocks and block
diagram elements.
• An slreportgen.report.StateflowObjectProperties object for Stateflow chart elements.
See Also
slreportgen.finder.DiagramElementResult |
slreportgen.report.StateflowObjectProperties |
slreportgen.report.SimulinkObjectProperties
8-9
8 Functions
Introduced in R2017b
8-10
getReporter
getReporter
Class: slreportgen.finder.DiagramResult
Package: slreportgen.finder
Syntax
reporter = getReporter(result)
Description
reporter = getReporter(result) returns an slreportgen.report.Diagram reporter for the
diagram returned by this report. The diagram reporter adds a snapshot of the diagram to a report. A
report or reporter to which you add a diagram result invokes this method to create an image of the
diagram that the result contains. If you need to change the size or otherwise customize the diagram
image, you can invoke this method to get the diagram reporter. Then, modify the reporter and add the
modified diagram reporter to a destination report or reporter.
Input Arguments
result — Diagram finder object
finder object
Output Arguments
reporter — Diagram reporter object
slreportgen.report.Diagram object
See Also
slreportgen.finder.DiagramFinder | slreportgen.report.Diagram
Introduced in R2017b
8-11
8 Functions
getReporter
Class: slreportgen.finder.ModelVariableResult
Package: slreportgen.finder
Syntax
reporter = getReporter(variableResult)
Description
reporter = getReporter(variableResult) returns an
slreportgen.report.ModelVariable object for a model variable search result.
Input Arguments
variableResult — Result of model variable search
slreportgen.finder.ModelVariableResult object
Output Arguments
reporter — Reporter for model variable
slreportgen.report.ModelVariable object
Reporter that includes information about a model variable in a report. Customize the content and
formatting of the information for a variable by setting properties of the reporter.
Examples
Customize the formatting of a model variable in a report by setting the reporter properties.
% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");
% Create a Chapter
chapter = mlreportgen.report.Chapter();
chapter.Title = "Model Variable Reporter Example";
8-12
getReporter
while hasNext(finder)
result = next(finder);
See Also
slreportgen.finder.ModelVariableFinder | slreportgen.finder.ModelVariableResult
| slreportgen.report.ModelVariable
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
8-13
8 Functions
getVariableID
Class: slreportgen.finder.ModelVariableResult
Package: slreportgen.finder
Syntax
varID = getVariableID(variableResult)
Description
varID = getVariableID(variableResult) returns a string that uniquely identifies the variable
represented by the model variable search result. This ID is the default value of the LinkTarget
property of the slreportgen.report.ModelVariable reporter for the variable. Therefore, you
can use the ID to generate a link to the reported content for the variable.
Input Arguments
variableResult — Result that represents a model variable
slreportgen.finder.ModelVariableResult object
Output Arguments
varID — Variable ID
string scalar
Examples
You can use the variable ID returned by the getVariableID method to create a link to the reported
content for the variable. This example generates a report of the variables used by the
slrgex_sf_car model. The list of variables at the beginning of the report provides links to the
reported content for the variables.
% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");
8-14
getVariableID
% Create a Chapter
chapter = mlreportgen.report.Chapter();
chapter.Title = sprintf("Variables Used in the %s model",model_name);
% Create a list of the variables with links to the reported variable content
ul = mlreportgen.dom.OrderedList;
for r = results
varname = r.Name;
%get ID that is used for the link target for this variable
varid = getVariableID(r);
link = mlreportgen.dom.InternalLink(varid,varname);
li = mlreportgen.dom.ListItem();
append(li,link);
append(ul,li);
end
add(chapter,ul);
end
add(rpt,chapter);
See Also
slreportgen.finder.ModelVariableResult | slreportgen.report.ModelVariable |
slreportgen.finder.ModelVariableFinder
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
8-15
8 Functions
getVariableValue
Class: slreportgen.finder.ModelVariableResult
Package: slreportgen.finder
Syntax
value = getVariableValue(variableResult)
Description
value = getVariableValue(variableResult) returns the value of the variable represented by
the model variable search result.
Input Arguments
variableResult — Result that represents a model variable
slreportgen.finder.ModelVariableResult object
Examples
mdl = "sldemo_bus_arrays";
load_system(mdl);
for r = results
% If the result represents a Bus object, add a Bus object reporter to the
% report
if isa(getVariableValue(r), "Simulink.Bus")
reporter = slreportgen.report.BusObject(r);
% Add the reporter to a chapter in the report
ch = mlreportgen.report.Chapter(reporter.Name);
add(ch, reporter);
add(rpt, ch);
8-16
getVariableValue
end
end
See Also
slreportgen.finder.ModelVariableResult | slreportgen.report.BusObject |
slreportgen.report.ModelVariable | slreportgen.finder.ModelVariableFinder
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
8-17
8 Functions
slreportgen.report.Bus.createTemplate
Class: slreportgen.report.Bus
Package: slreportgen.report
Syntax
template = slreportgen.report.Bus.createTemplate(templatePath,type)
Description
template = slreportgen.report.Bus.createTemplate(templatePath,type) creates a
copy of the slreportgen.report.Bus reporter template for the report type specified by type at
the location specified by templatePath. You can use the copied template as a starting point to
design a custom bus reporter template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.Bus reporter and save it with
the name myBusTemplate in the mytemplates folder.
template = slreportgen.report.Bus.createTemplate...
('mytemplates/myBusTemplate','html');
8-18
slreportgen.report.Bus.createTemplate
After you modify the template, you can use it by setting the TemplateSrc property of a Bus reporter
to the path of the template file.
See Also
slreportgen.report.Bus | slreportgen.report.Report
Introduced in R2021a
8-19
8 Functions
slreportgen.report.Bus.customizeReporter
Class: slreportgen.report.Bus
Package: slreportgen.report
Syntax
reporter = slreportgen.report.Bus.customizeReporter(classpath)
Description
reporter = slreportgen.report.Bus.customizeReporter(classpath) creates a reporter
class definition file that defines a subclass of slreportgen.report.Bus at the location specified by
classpath. The method also copies the default reporter templates to the resources/templates
subfolder of the folder that contains the class definition file. You can use the class definition file as a
starting point to design a custom bus reporter class for your report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.Bus.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.Bus.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a bus reporter in the myOrg package folder in the current folder.
slreportgen.report.Bus.customizeReporter("+myOrg/@MyClass")
Output Arguments
reporter — Path and file name of new reporter class
string scalar
Path and file name of the new reporter class, returned as a string scalar.
8-20
slreportgen.report.Bus.customizeReporter
Examples
Create a custom bus reporter, myBus, and the associated default templates in the subfolder
MyFolder of the current working folder.
slreportgen.report.Bus.customizeReporter("MyFolder/myBus")
ans =
"MyFolder\myBus.m"
See Also
slreportgen.report.Bus | slreportgen.report.Report
Introduced in R2021a
8-21
8 Functions
slreportgen.report.Bus.getClassFolder
Class: slreportgen.report.Bus
Package: slreportgen.report
Get location of folder that contains the slreportgen.report.Bus class definition file
Syntax
path = slreportgen.report.Bus.getClassFolder()
Description
path = slreportgen.report.Bus.getClassFolder() returns the path of the folder that
contains the slreportgen.report.Bus class definition file.
Output Arguments
path — slreportgen.report.Bus class definition file location
character vector
Examples
Get the location of the folder that contains the bus reporter class definition file.
path = slreportgen.report.Bus.getClassFolder()
See Also
slreportgen.report.Bus | slreportgen.report.Report
Introduced in R2021a
8-22
slreportgen.report.BusObject.createTemplate
slreportgen.report.BusObject.createTemplate
Class: slreportgen.report.BusObject
Package: slreportgen.report
Syntax
template = slreportgen.report.BusObject.createTemplate(templatePath,type)
Description
template = slreportgen.report.BusObject.createTemplate(templatePath,type)
creates a copy of the bus object reporter template specified by type at the templatePath location.
You can use the copied template as a starting point to design a custom bus object template for your
report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the bus object reporter and save it with the name
myBusTemplate in the mytemplates folder.
template = slreportgen.report.BusObject.createTemplate...
('mytemplates/myBusObjectTemplate','html');
8-23
8 Functions
After you modify the template, you can use it by setting the TemplateSrc property of the reporter.
See Also
slreportgen.report.BusObject | slreportgen.report.Report
Introduced in R2019b
8-24
slreportgen.report.BusObject.customizeReporter
slreportgen.report.BusObject.customizeReporter
Class: slreportgen.report.BusObject
Package: slreportgen.report
Syntax
reporter = slreportgen.report.BusObject.customizeReporter(classpath)
Description
reporter = slreportgen.report.BusObject.customizeReporter(classpath) creates a
reporter class definition file that defines a subclass of slreportgen.report.BusObject. The
slreportgen.report.BusObject.customizeReporter method creates the reporter class
definition file at the location specified by classpath. The method also copies the default reporter
templates to the resources/templates subfolder of the folder that contains the class definition
file. You can use the class definition file as a starting point to design a custom bus object reporter
class for your report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.BusObject.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.BusObject.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a bus object reporter in the myOrg package folder in the current folder.
slreportgen.report.BusObject.customizeReporter("+myOrg/@MyClass")
Output Arguments
reporter — Path and file name of new bus object reporter class
string scalar
Path and file name of the new bus object reporter class, returned as a string scalar.
8-25
8 Functions
Examples
Create a custom bus object reporter, MyBus, and the associated default templates in the subfolder
MyFolder of the current working folder.
slreportgen.report.BusObject.customizeReporter('MyFolder/MyBus')
ans =
"MyFolder\MyBus.m"
See Also
slreportgen.report.BusObject | slreportgen.report.Report
Introduced in R2019b
8-26
slreportgen.report.BusObject.getClassFolder
slreportgen.report.BusObject.getClassFolder
Class: slreportgen.report.BusObject
Package: slreportgen.report
Syntax
path = slreportgen.report.BusObject.getClassFolder()
Description
path = slreportgen.report.BusObject.getClassFolder() returns the path of the folder
that contains the slreportgen.report.BusObject class definition file.
Output Arguments
path — Bus object reporter class definition file location
character vector
Examples
Get the location of the folder that contains the bus object reporter class definition.
path = slreportgen.report.BusObject.getClassFolder()
See Also
slreportgen.report.BusObject | slreportgen.report.Report
Introduced in R2019b
8-27
8 Functions
slreportgen.report.CFunction.createTemplate
Class: slreportgen.report.CFunction
Package: slreportgen.report
Syntax
template = slreportgen.report.CFunction.createTemplate(templatePath,type)
Description
template = slreportgen.report.CFunction.createTemplate(templatePath,type)
creates a copy of the slreportgen.report.CFunction reporter template for the report type
specified by type at the location specified by templatePath. You can use the template copy as a
starting point to design a custom C Function block reporter template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.CFunction reporter and save it
with the name myCFunctionTemplate in the mytemplates folder.
template = slreportgen.report.CFunction.createTemplate...
('mytemplates/myCFunctionTemplate','html');
8-28
slreportgen.report.CFunction.createTemplate
After you modify the template, you can use it by setting the TemplateSrc property of a CFunction
reporter to the path of the template file.
See Also
slreportgen.report.CFunction | slreportgen.report.Report
Introduced in R2021b
8-29
8 Functions
slreportgen.report.CFunction.customizeReporter
Class: slreportgen.report.CFunction
Package: slreportgen.report
Syntax
reporter = slreportgen.report.CFunction.customizeReporter(classpath)
Description
reporter = slreportgen.report.CFunction.customizeReporter(classpath) creates a
reporter class definition file that defines a subclass of slreportgen.report.CFunction at the
location specified by classpath. The method also copies the default reporter templates to the
resources/templates subfolder of the folder that contains the class definition file. You can use the
class definition file as a starting point to design a custom C Function block reporter class for your
report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.CFunction.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.CFunction.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a C Function block reporter in the myOrg package folder in the current
folder.
slreportgen.report.CFunction.customizeReporter("+myOrg/@MyClass")
Output Arguments
reporter — Path and file name of new reporter class
string scalar
Path and file name of the new reporter class, returned as a string scalar.
8-30
slreportgen.report.CFunction.customizeReporter
Examples
Create a custom C Function block reporter, myCFunction, and the associated default templates in
the subfolder MyFolder of the current working folder.
slreportgen.report.CFunction.customizeReporter("MyFolder/myCFunction")
ans =
"MyFolder\myCFunction.m"
See Also
slreportgen.report.CFunction | slreportgen.report.Report
Introduced in R2021b
8-31
8 Functions
slreportgen.report.CFunction.getClassFolder
Class: slreportgen.report.CFunction
Package: slreportgen.report
Get location of folder that contains the slreportgen.report.CFunction class definition file
Syntax
path = slreportgen.report.CFunction.getClassFolder()
Description
path = slreportgen.report.CFunction.getClassFolder() returns the path of the folder
that contains the slreportgen.report.CFunction class definition file.
Output Arguments
path — slreportgen.report.CFunction class definition file location
character vector
Examples
Get the location of the folder that contains the CFunction reporter class definition file.
path = slreportgen.report.CFunction.getClassFolder()
See Also
slreportgen.report.CFunction | slreportgen.report.Report
Introduced in R2021b
8-32
slreportgen.report.DataDictionary.createTemplate
slreportgen.report.DataDictionary.createTemplate
Class: slreportgen.report.DataDictionary
Package: slreportgen.report
Syntax
template = slreportgen.report.DataDictionary.createTemplate(templatePath,
type)
Description
template = slreportgen.report.DataDictionary.createTemplate(templatePath,
type) creates a copy of the slreportgen.report.DataDictionary reporter template for the
report type specified by type at the location specified by templatePath. You can use the copy of the
template as a starting point to design a custom slreportgen.report.DataDictionary template
for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.DataDictionary reporter and
save it with the name myDataDictionaryTemplate in the mytemplates folder.
8-33
8 Functions
template = slreportgen.report.DataDictionary.createTemplate...
('mytemplates/myDataDictionaryTemplate','html');
After you modify the template, you can use it by setting the TemplateSrc property of a data
dictionary reporter to the path of the template file.
See Also
slreportgen.report.Report | slreportgen.report.DataDictionary
Introduced in R2020b
8-34
slreportgen.report.DataDictionary.customizeReporter
slreportgen.report.DataDictionary.customizeRepor
ter
Class: slreportgen.report.DataDictionary
Package: slreportgen.report
Syntax
reporter = slreportgen.report.DataDictionary.customizeReporter(classpath)
Description
reporter = slreportgen.report.DataDictionary.customizeReporter(classpath)
creates a reporter class definition file that defines a subclass of
slreportgen.report.DataDictionary at the location specified by classpath. The method also
copies the default reporter templates to the resources/templates subfolder of the folder that
contains the class definition file. You can use the class definition file as a starting point to design a
custom data dictionary reporter class for your report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.DataDictionary.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.DataDictionary.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a data dictionary reporter in the myOrg package folder in the current
folder.
slreportgen.report.DataDictionary.customizeReporter("+myOrg/@MyClass")
Output Arguments
reporter — Path and file name of new reporter class
string scalar
8-35
8 Functions
Path and file name of the new reporter class, returned as a string scalar.
Examples
Create a custom data dictionary reporter, myDataDictionary, and the associated default templates
in the subfolder MyFolder of the current working folder.
slreportgen.report.DataDictionary.customizeReporter('MyFolder/myDataDictionary')
ans =
"MyFolder\myDataDictionary.m"
See Also
slreportgen.report.Report | slreportgen.report.DataDictionary
Introduced in R2020b
8-36
slreportgen.report.DataDictionary.getClassFolder
slreportgen.report.DataDictionary.getClassFolder
Class: slreportgen.report.DataDictionary
Package: slreportgen.report
Get location of folder that contains the slreportgen.report.DataDictionary class definition file
Syntax
path = slreportgen.report.DataDictionary.getClassFolder()
Description
path = slreportgen.report.DataDictionary.getClassFolder() returns the path of the
folder that contains the slreportgen.report.DataDictionary class definition file.
Output Arguments
path — slreportgen.report.DataDictionary class definition file location
character vector
Examples
Get the location of the folder that contains the data dictionary reporter class definition file.
path = slreportgen.report.DataDictionary.getClassFolder()
See Also
slreportgen.report.Report | slreportgen.report.DataDictionary
Introduced in R2020b
8-37
8 Functions
slreportgen.report.Diagram.createTemplate
Class: slreportgen.report.Diagram
Package: slreportgen.report
Syntax
template = slreportgen.report.Diagram.createTemplate(templatePath,type)
Description
template = slreportgen.report.Diagram.createTemplate(templatePath,type) creates
a copy of the default diagram template specified by type at the location specified by templatePath.
Use the copied template as a starting point to design a custom diagram template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a Report Template
Before you run this example, create a copy of the default HTML diagram template in the
mytemplates folder. Name the copied template myDiagramReporter.htmtx. To use the new
template, assign its path to the slreportgen.report.Diagram TemplateSrc property.
import slreportgen.report.*
rpt = Report('My Report','html');
load_system('slrgex_sf_car')
diagram = Diagram('slrgex_sf_car');
8-38
slreportgen.report.Diagram.createTemplate
template = Diagram.createTemplate('mytemplates\myDiagram','html');
diagram.TemplateSrc = template;
See Also
slreportgen.report.Diagram | slreportgen.report.Report
Introduced in R2017b
8-39
8 Functions
slreportgen.report.Diagram.customizeReporter
Class: slreportgen.report.Diagram
Package: slreportgen.report
Syntax
reporter = slreportgen.report.Diagram.customizeReporter(classpath)
Description
reporter = slreportgen.report.Diagram.customizeReporter(classpath) creates a
diagram class definition file that is a subclass of slreportgen.report.Diagram. The file is created
at the specified classpath location. The customizeReporter method also copies the default
diagram templates to the <classpath>/resources/template folder. You can use the new class
definition file as a starting point to design a custom diagram class for your report.
Input Arguments
classpath — Location of custom diagram class
current working folder (default) | string | character array
Location of custom diagram class, specified as a string or character array. The classpath argument
also supports specifying a folder with @ before the class name.
Output Arguments
reporter — Diagram reporter path
string
Diagram reporter path, returned as the string specifying the path to the derived report class file.
Examples
Create Custom Diagram Reporter
Create a custom diagram reporter and its associated default templates. The derived class file is
created at the specified path relative to the current working folder. In this case, the path to the
MyDiagram.m class file is <current working folder>/newDiagram/@MyDiagram/
MyDiagram.m. The default diagram templates are in the <current working folder>/
newDiagram/@MyDiagram/resources/templates folder.
import slreportgen.report.*
Diagram.customizeReporter('newDiagram/@MyDiagram');
After editing this new class file and loading a model, you can use the new diagram reporter.
slrgex_sf_car;
diagram = MyDiagram('slrgex_sf_car');
8-40
slreportgen.report.Diagram.customizeReporter
See Also
slreportgen.report.Diagram | slreportgen.report.Report
Introduced in R2017b
8-41
8 Functions
slreportgen.report.Diagram.getClassFolder
Class: slreportgen.report.Diagram
Package: slreportgen.report
Syntax
path = slreportgen.report.Diagram.getClassFolder()
Description
path = slreportgen.report.Diagram.getClassFolder() returns the path of the folder that
contains the diagram class definition file.
Output Arguments
path — Diagram class definition file location
character array
See Also
slreportgen.report.Diagram | slreportgen.report.Report
Introduced in R2017b
8-42
getSnapshotImage
getSnapshotImage
Class: slreportgen.report.Diagram
Package: slreportgen.report
Syntax
path = getSnapshotImage(diag,rpt)
Description
path = getSnapshotImage(diag,rpt) takes the snapshot of the diagram specified by the
slreportgen.report.Diagram reporter (diag). It creates an image file and returns the path of
that file. rpt is the report into which the diagram is added. This method gives you access to the
image file so you can place it in specific locations of the report, such as on a title page. By changing
the report layout and then adding this image, you can control the image layout.
Note If you use this method, set the Diagram Scaling property to custom or zoom. If you use auto
scaling, the image does not scale to fit on the page.
Input Arguments
diag — Dialog reporter
variable name
Dialog reporter, specified as the variable name of the Diagram class. For example,
rpt = slreportgen.report.Report
diag = slreportgen.report.Diagram...
("f14/Aircraft Dynamics Model");
getSnapshotImage(diag,rpt)
Name of the report into which the diagram will go, specified as the report variable name.
Output Arguments
path — Location of snapshot image file
string
Location of snapshot image file, returned as a string. The location is a temporary folder that is
deleted when the report is closed. To retain the folder, set the Debug property of
slreportgen.report.Report.
8-43
8 Functions
See Also
slreportgen.report.Diagram | slreportgen.report.Report
Introduced in R2018b
8-44
slreportgen.report.DocBlock.createTemplate
slreportgen.report.DocBlock.createTemplate
Class: slreportgen.report.DocBlock
Package: slreportgen.report
Syntax
template = slreportgen.report.DocBlock.createTemplate(templatePath,type)
Description
template = slreportgen.report.DocBlock.createTemplate(templatePath,type)
creates a copy of the DocBlock reporter template specified by type at the templatePath location.
You can use the copied template as a starting point to design a custom DocBlock template for your
report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the DocBlock reporter and save it with the name
myDocBlockTemplate in the mytemplates folder.
template = slreportgen.report.DocBlock.createTemplate...
('mytemplates/myDocBlockTemplate','html');
8-45
8 Functions
After you modify the template, you can use it by setting the TemplateSrc property of the reporter.
See Also
slreportgen.report.DocBlock | slreportgen.report.Report
Topics
“Modify Styles in a Microsoft Word Template”
“Modify Styles in HTML Templates”
“Modify Styles in PDF Templates”
Introduced in R2019b
8-46
slreportgen.report.DocBlock.customizeReporter
slreportgen.report.DocBlock.customizeReporter
Class: slreportgen.report.DocBlock
Package: slreportgen.report
Syntax
reporter = slreportgen.report.DocBlock.customizeReporter(classpath)
Description
reporter = slreportgen.report.DocBlock.customizeReporter(classpath) creates a
class definition file that defines a subclass of slreportgen.report.DocBlock at the location
specified by classpath. The method also copies the default reporter templates to the resources/
templates subfolder of the folder that contains the class definition file. You can use the class
definition file as a starting point to design a custom DocBlock reporter class for your report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.DocBlock.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.DocBlock.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a DocBlock reporter in the myOrg package folder in the current folder.
slreportgen.report.DocBlock.customizeReporter("+myOrg/@DocBlock");
Output Arguments
reporter — Path and file name of the new DocBlock reporter class
string scalar
Path and file name of the new DocBlock reporter class, returned as a string scalar.
8-47
8 Functions
Examples
Create a custom DocBlock reporter, MyDocBlock, and its associated default templates in the
subfolder MyFolder of the current working folder.
slreportgen.report.DocBlock.customizeReporter('MyFolder/MyDocBlock')
ans =
"MyFolder\MyDocBlock.m"
After editing this new class file, you can use it as your DocBlock reporter.
rptr = MyDocBlock();
Create a custom DocBlock reporter and its associated default templates in a class folder that is a
subfolder of a package folder.
slreportgen.report.DocBlock.customizeReporter("+MyPackage/@MyDocBlock")
ans =
"+MyPackage\@MyDocBlock\MyDocBlock.m"
After editing this new class file, you can use it as your DocBlock reporter.
rptr = MyPackage.MyDocBlock();
See Also
slreportgen.report.DocBlock | slreportgen.report.Report
Introduced in R2019b
8-48
slreportgen.report.DocBlock.getClassFolder
slreportgen.report.DocBlock.getClassFolder
Class: slreportgen.report.DocBlock
Package: slreportgen.report
Syntax
path = slreportgen.report.DocBlock.getClassFolder()
Description
path = slreportgen.report.DocBlock.getClassFolder() returns the path of the folder that
contains the slreportgen.report.DocBlock class definition file.
Output Arguments
path — Location of the DocBlock reporter class definition file
character vector
Examples
Get the location of the folder that contains the DocBlock reporter class definition.
path = slreportgen.report.DocBlock.getClassFolder()
See Also
slreportgen.report.DocBlock | slreportgen.report.Report
Introduced in R2019b
8-49
8 Functions
slreportgen.report.ElementDiagram.createTemplat
e
Class: slreportgen.report.ElementDiagram
Package: slreportgen.report
Syntax
template = slreportgen.report.ElementDiagram.createTemplate(templatePath,
type)
Description
template = slreportgen.report.ElementDiagram.createTemplate(templatePath,
type) creates a copy of the default element diagram reporter template specified by type at the
location specified by templatePath. Use the copied template as a starting point to design a custom
diagram template for your report.
Input Arguments
templatePath — Location of reporter template
string | character vector | character array | template source object
Location of the reporter template, specified as a character vector, character array, or template source
object.
Output Arguments
template — Template name
string
Name of template, returned as the path and file name of the template. The template file name
extension is assigned based on the specified output type. For example, for PDF output, the template
name has a .pdftx file extension.
Examples
Create an Element Diagram Template
slreportgen.report.ElementDiagram.createTemplate...
('mytemplates\myElemDiagram','html');
8-50
slreportgen.report.ElementDiagram.createTemplate
See Also
slreportgen.report.ElementDiagram | slreportgen.report.Report
Introduced in R2018b
8-51
8 Functions
slreportgen.report.ElementDiagram.customizeRep
orter
Class: slreportgen.report.ElementDiagram
Package: slreportgen.report
Syntax
customRptrPath = slreportgen.report.ElementDiagram.customizeReporter(
classpath)
Description
customRptrPath = slreportgen.report.ElementDiagram.customizeReporter(
classpath) creates an empty element diagram class definition file that is a subclass of
slreportgen.report.ElementDiagram. The file is created at the specified classpath location.
The customizeReporter method also copies the default element diagram templates to the
<classpath>/resources/template folder. You can use the new class definition file as a starting
point to design a custom element diagram class for your report.
Input Arguments
classpath — Location of custom element diagram class
current working folder (default) | string | character array
Location of custom element diagram class, specified as a string or character array. The classpath
argument also supports specifying a folder with @ before the class name. For example, both of these
are valid paths:
• slreportgen.report.ElementDiagram.customizeReporter("path_folder/
MyClassA.m")
• slreportgen.report.ElementDiagram.customizeReporter("+package/@MyClassB")
Output Arguments
customRptrPath — Path of custom element diagram reporter
string
Path of the custom element diagram reporter classdef file that defines the custom element diagram
reporter, specified as a string.
Examples
Create Custom Element Diagram Reporter
Create a custom element diagram reporter and its associated default templates. The derived class file
is created at the specified path relative to the current working folder. In this case, the path to the
8-52
slreportgen.report.ElementDiagram.customizeReporter
import slreportgen.report.*
ElementDiagram.customizeReporter('newElemDiagram/@MyElemDiagram');
After editing this new class file and loading a model, you can use the new diagram reporter.
slrgex_sf_car;
diagram = MyElemDiagram('slrgex_sf_car');
See Also
slreportgen.report.Report
Introduced in R2018b
8-53
8 Functions
slreportgen.report.ElementDiagram.getClassFolde
r
Class: slreportgen.report.ElementDiagram
Package: slreportgen.report
Syntax
path = slreportgen.report.ElementDiagram.getClassFolder()
Description
path = slreportgen.report.ElementDiagram.getClassFolder() returns the path of the
folder that contains the element diagram class definition file.
Output Arguments
path — Element diagram class definition file location
character array
See Also
slreportgen.report.Diagram | slreportgen.report.Report |
slreportgen.report.ElementDiagram
Introduced in R2018b
8-54
getSnapshotImage
getSnapshotImage
Class: slreportgen.report.ElementDiagram
Package: slreportgen.report
Syntax
path = getSnapshotImage(elemdiag,rpt)
Description
path = getSnapshotImage(elemdiag,rpt) generates the image of the element diagram this
reporter would generate if it were added to the report (rpt). This method returns the path of the
generated image. Use this method to take snapshots of element diagrams without having to add the
ElementDiagram reporter to a report. For example, you can use this method to set the Image
property of a TitlePage reporter to a snapshot of an element diagram.
Note If you use this method, set the ElementDiagram Scaling property to custom or zoom. If you
use auto scaling, the image does not scale to fit on the page.
Input Arguments
elemdiag — Element diagram reporter
ElementDiagram object
load_system('f14')
rpt = slreportgen.report.Report;
eldiag = slreportgen.report.ElementDiagram...
("f14/Aircraft Dynamics Model");
getSnapshotImage(eldiag,rpt);
Output Arguments
path — Location of snapshot image file
string
Location of snapshot image file, returned as a string. The location is a temporary folder that is
deleted when the report is closed. To retain the folder, set the Debug property of
slreportgen.report.Report.
8-55
8 Functions
See Also
slreportgen.report.ElementDiagram | slreportgen.report.Report
Introduced in R2018b
8-56
slreportgen.report.ExecutionOrder.createTemplate
slreportgen.report.ExecutionOrder.createTemplate
Class: slreportgen.report.ExecutionOrder
Package: slreportgen.report
Syntax
template = slreportgen.report.ExecutionOrder.createTemplate(templatePath,
type)
Description
template = slreportgen.report.ExecutionOrder.createTemplate(templatePath,
type) creates a copy of the slreportgen.report.ExecutionOrder reporter template for the
report type specified by type at the location specified by templatePath. You can use the copied
template as a starting point to design a custom execution order reporter template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.ExecutionOrder reporter and
save it with the name myExecutionOrderTemplate in the mytemplates folder.
template = slreportgen.report.ExecutionOrder.createTemplate...
('mytemplates/myExecutionOrder','html');
8-57
8 Functions
After you modify the template, you can use it by setting the TemplateSrc property of an
ExecutionOrder reporter to the path of the template file.
See Also
slreportgen.report.ExecutionOrder
Introduced in R2020b
8-58
slreportgen.report.ExecutionOrder.customizeReporter
slreportgen.report.ExecutionOrder.customizeRepo
rter
Class: slreportgen.report.ExecutionOrder
Package: slreportgen.report
Syntax
reporter = slreportgen.report.ExecutionOrder.customizeReporter(classpath)
Description
reporter = slreportgen.report.ExecutionOrder.customizeReporter(classpath)
creates a class definition file that defines a subclass of slreportgen.report.ExecutionOrder at
the location specified by classpath. This method also copies the default reporter templates to the
resources/templates subfolder of the folder that contains the class definition file. You can use the
class definition file as a starting point to design a custom execution order reporter class for your
report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.ExecutionOrder.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.ExecutionOrder.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates an execution order reporter in the myOrg package folder in the current
folder.
slreportgen.report.ExecutionOrder.customizeReporter("+myOrg/@MyClass");
Output Arguments
reporter — Path and file name of new execution order reporter class
string scalar
8-59
8 Functions
Path and file name of the new execution order reporter class, returned as a string scalar.
Examples
Create a custom execution order reporter, MyExcutionOrder, and its associated default templates in
the subfolder MyFolder of the current working folder.
slreportgen.report.ExecutionOrder.customizeReporter('MyFolder/MyExecutionOrder')
ans =
"MyFolder\MyExecutionOrder.m"
See Also
slreportgen.report.ExecutionOrder
Introduced in R2020b
8-60
slreportgen.report.ExecutionOrder.getClassFolder
slreportgen.report.ExecutionOrder.getClassFolder
Class: slreportgen.report.ExecutionOrder
Package: slreportgen.report
Syntax
path = slreportgen.report.ExecutionOrder.getClassFolder()
Description
path = slreportgen.report.ExecutionOrder.getClassFolder() returns the path of the
folder that contains the slreportgen.report.ExecutionOrder class definition file.
Output Arguments
path — Location of the execution order reporter class definition file
character vector
Examples
Get the folder that contains the slreportgen.report.ExecutionOrder reporter class definition.
path = slreportgen.report.ExecutionOrder.getClassFolder();
See Also
slreportgen.report.ExecutionOrder
Introduced in R2020b
8-61
8 Functions
slreportgen.report.LookupTable.createTemplate
Class: slreportgen.report.LookupTable
Package: slreportgen.report
Syntax
template = slreportgen.report.LookupTable.createTemplate(templatePath,type)
Description
template = slreportgen.report.LookupTable.createTemplate(templatePath,type)
creates a copy of the LookupTable reporter template specified by type at the templatePath
location. You can use the copied template as a starting point to design a custom LookupTable reporter
template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create LookupTable Reporter Template
Before you run this example, create a copy of the default HTML LookupTable template and save it in
a mytemplates folder. Name the copied template myLUTable.htmtx. Edit the template as desired. To
use the new template for the lookup table, assign its path to the TemplateSrc property of
slreportgen.report.LookupTable.
import mlreportgen.report.*
import slreportgen.report.*
8-62
slreportgen.report.LookupTable.createTemplate
See Also
slreportgen.report.Report | slreportgen.report.LookupTable
Topics
“Modify Styles in a Microsoft Word Template”
“Modify Styles in HTML Templates”
“Modify Styles in PDF Templates”
Introduced in R2018a
8-63
8 Functions
slreportgen.report.LookupTable.customizeReporte
r
Class: slreportgen.report.LookupTable
Package: slreportgen.report
Syntax
reporter = slreportgen.report.LookupTable.customizeReporter(classpath)
Description
reporter = slreportgen.report.LookupTable.customizeReporter(classpath) creates a
LookupTable reporter class definition file that is a subclass of
slreportgen.report.LookupTable. The file is created at the specified classpath location. The
LookupTable.customizeReporter method also copies the default LookupTable reporter
templates to the <classpath>/resources/template folder. You can use the class definition file as
a starting point to design a custom LookupTable reporter class for your report.
Input Arguments
classpath — Location of custom lookup table reporter class
current working folder (default) | string | character array
Location of custom lookup table reporter class, specified as a string or character array. The
classpath argument also supports specifying a folder with @ before the class name.
Output Arguments
reporter — Lookup table reporter path
string
Lookup table reporter path, returned as the string specifying the path to the derived report class file.
Examples
Create Custom Lookup Table Reporter
Create a custom lookup table reporter and its associated default templates. The derived class file is
created at the specified path relative to the current working folder. In this case, the path to the
myLUTable.m class file is <current working folder>/newLUTable/@myLUTable/
myLUTable.m. The default lookup table reporter templates are in the <current working
folder>/newLUTable/@myLUTable/resources/templates folder.
import mlreportgen.report.*
import slreportgen.report.*
LookupTable.customizeReporter('newLUTable/@myLUTable');
8-64
slreportgen.report.LookupTable.customizeReporter
After editing this new class file, you can use it as your LookupTable reporter.
lutable = myLUTable();
See Also
slreportgen.report.Report | slreportgen.report.LookupTable
Introduced in R2018a
8-65
8 Functions
slreportgen.report.LookupTable.getClassFolder
Class: slreportgen.report.LookupTable
Package: slreportgen.report
Syntax
path = slreportgen.report.LookupTable.getClassFolder()
Description
path = slreportgen.report.LookupTable.getClassFolder() returns the path of the folder
that contains the LookupTable class definition file.
Output Arguments
path — Lookup Table class definition file location
character array
See Also
slreportgen.report.Report | slreportgen.report.LookupTable
Introduced in R2018a
8-66
slreportgen.report.MATLABFunction.createTemplate
slreportgen.report.MATLABFunction.createTemplat
e
Class: slreportgen.report.MATLABFunction
Package: slreportgen.report
Syntax
template = slreportgen.report.MATLABFunction.createTemplate(templatePath,
type)
Description
template = slreportgen.report.MATLABFunction.createTemplate(templatePath,
type) creates a copy of the slreportgen.report.MATLABFunction reporter template for the
report type specified by type at the location specified by templatePath. You can use the copied
template as a starting point to design a custom MATLABFunction reporter template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create MATLAB Function Reporter Template
Create a copy of the HTML template for the slreportgen.report.MATLABFunction reporter and
save it with the name myMATLABFunctionTemplate in the mytemplates folder.
8-67
8 Functions
template = slreportgen.report.MATLABFunction.createTemplate...
('mytemplates/myMATLABFunctionTemplate','html');
After you modify the template, you can use it by setting the TemplateSrc property of a
MATLABFunction reporter to the path of the template file.
See Also
slreportgen.report.MATLABFunction | slreportgen.report.Report
Topics
“Modify Styles in a Microsoft Word Template”
“Modify Styles in HTML Templates”
“Modify Styles in PDF Templates”
Introduced in R2018a
8-68
slreportgen.report.MATLABFunction.customizeReporter
slreportgen.report.MATLABFunction.customizeRep
orter
Class: slreportgen.report.MATLABFunction
Package: slreportgen.report
Syntax
reporter = slreportgen.report.MATLABFunction.customizeReporter(classpath)
Description
reporter = slreportgen.report.MATLABFunction.customizeReporter(classpath)
creates a reporter class definition file that defines a subclass of
slreportgen.report.MATLABFunction at the location specified by classpath. The method also
copies the default reporter templates to the resources/templates subfolder of the folder that
contains the class definition file. You can use the class definition file as a starting point to design a
custom MATLAB function reporter class for your report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of the new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.MATLABFunction.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.MATLABFunction.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a MATLAB function reporter in the myOrg package folder in the current
folder.
slreportgen.report.MATLABFunction.customizeReporter("+myOrg/@MyClass")
Output Arguments
reporter — Path and file name of new reporter class
string scalar
8-69
8 Functions
Path and file name of the new reporter class, returned as a string scalar.
Examples
Create Custom MATLAB Function Reporter
slreportgen.report.MATLABFunction.customizeReporter("MyFolder/myMATLABFunction")
ans =
"MyFolder\myMATLABFunction.m"
See Also
slreportgen.report.MATLABFunction | slreportgen.report.Report
Introduced in R2018a
8-70
slreportgen.report.MATLABFunction.getClassFolder
slreportgen.report.MATLABFunction.getClassFolde
r
Class: slreportgen.report.MATLABFunction
Package: slreportgen.report
Syntax
path = slreportgen.report.MATLABFunction.getClassFolder()
Description
path = slreportgen.report.MATLABFunction.getClassFolder() returns the path of the
folder that contains the slreportgen.report.MATLABFunction class definition file.
Output Arguments
path — slreportgen.report.MATLABFunction class definition file location
character vector
Examples
Get the location of the folder that contains the slreportgen.report.MATLABFunction reporter
class definition file.
path = slreportgen.report.MATLABFunction.getClassFolder()
See Also
slreportgen.report.MATLABFunction | slreportgen.report.Report
Introduced in R2018a
8-71
8 Functions
slreportgen.report.ModelConfiguration.createTem
plate
Class: slreportgen.report.ModelConfiguration
Package: slreportgen.report
Syntax
template = slreportgen.report.ModelConfiguration.createTemplate(templatePath,
type)
Description
template = slreportgen.report.ModelConfiguration.createTemplate(templatePath,
type) creates a copy of the slreportgen.report.ModelConfiguration reporter template for
the report type specified by type at the location specified by templatePath. You can use the copied
template as a starting point to design a custom model configuration reporter template for your
report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
8-72
slreportgen.report.ModelConfiguration.createTemplate
template = slreportgen.report.ModelConfiguration.createTemplate...
('mytemplates/myModelConfigurationTemplate','html');
After you modify the template, you can use it by setting the TemplateSrc property of a model
configuration reporter to the path of the template file.
See Also
slreportgen.report.ModelConfiguration
Introduced in R2020b
8-73
8 Functions
slreportgen.report.ModelConfiguration.customizeR
eporter
Class: slreportgen.report.ModelConfiguration
Package: slreportgen.report
Syntax
reporter = slreportgen.report.ModelConfiguration.customizeReporter(classpath)
Description
reporter = slreportgen.report.ModelConfiguration.customizeReporter(classpath)
creates a class definition file that defines a subclass of
slreportgen.report.ModelConfiguration at the location specified by classpath. This method
also copies the default reporter templates to the resources/templates subfolder of the folder that
contains the class definition file. You can use the class definition file as a starting point to design a
custom model configuration reporter class for your report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.ModelConfiguration.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.ModelConfiguration.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a model configuration reporter in the myOrg package folder in the current
folder.
slreportgen.report.ModelConfiguration.customizeReporter("+myOrg/@MyClass");
Output Arguments
reporter — Path and file name of new model configuration reporter class
string scalar
8-74
slreportgen.report.ModelConfiguration.customizeReporter
Path and file name of the new model configuration reporter class, returned as a string scalar.
Examples
Create a custom model configuration reporter, MyModelConfiguration, and its associated default
templates in the subfolder MyFolder of the current working folder.
slreportgen.report.ModelConfiguration.customizeReporter('MyFolder/MyModelConfiguration')
ans =
"MyFolder\MyModelConfiguration.m"
See Also
slreportgen.report.ModelConfiguration
Introduced in R2020b
8-75
8 Functions
slreportgen.report.ModelConfiguration.getClassFol
der
Class: slreportgen.report.ModelConfiguration
Package: slreportgen.report
Syntax
path = slreportgen.report.ModelConfiguration.getClassFolder()
Description
path = slreportgen.report.ModelConfiguration.getClassFolder() returns the path of
the folder that contains the slreportgen.report.ModelConfiguration class definition file.
Output Arguments
path — Location of the model configuration reporter class definition file
character vector
Examples
Get the folder that contains the model configuration reporter class definition.
path = slreportgen.report.ModelConfiguration.getClassFolder()
See Also
slreportgen.report.ModelConfiguration
Introduced in R2020b
8-76
getConfigSet
getConfigSet
Class: slreportgen.report.ModelConfiguration
Package: slreportgen.report
Syntax
configSetObj = getConfigSet(reporter)
Description
configSetObj = getConfigSet(reporter) returns the Simulink.ConfigSet object that
represents the active model configuration set to be reported by the specified
slreportgen.report.ModelConfiguration reporter.
Input Arguments
reporter — Model configuration reporter
slreportgen.report.ModelConfiguration object
Output Arguments
configSetObj — Model configuration set object
Simulink.ConfigSet object
Examples
model = "slrgex_sf_car";
load_system(model);
reporter = slreportgen.report.ModelConfiguration(model);
configSet = getConfigSet(reporter)
configSet =
Simulink.ConfigSet
See Also
Simulink.ConfigSet | slreportgen.report.ModelConfiguration
8-77
8 Functions
Introduced in R2020b
8-78
slreportgen.report.ModelVariable.createTemplate
slreportgen.report.ModelVariable.createTemplate
Class: slreportgen.report.ModelVariable
Package: slreportgen.report
Syntax
template = slreportgen.report.ModelVariable.createTemplate(templatePath,type)
Description
template = slreportgen.report.ModelVariable.createTemplate(templatePath,type)
creates a copy of the slreportgen.report.ModelVariable reporter template for the report type
specified by type at the location specified by templatePath. You can use the copied template as a
starting point to design a custom model variable reporter template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.ModelVariable reporter and
save it with the name myModelVariableTemplate in the mytemplates folder.
template = slreportgen.report.ModelVariable.createTemplate...
('mytemplates/myModelVariableTemplate','html');
8-79
8 Functions
After you modify the template, you can use it by setting the TemplateSrc property of the model
variable reporter.
See Also
slreportgen.finder.ModelVariableResult | slreportgen.report.ModelVariable |
slreportgen.finder.ModelVariableFinder
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
8-80
slreportgen.report.ModelVariable.customizeReporter
slreportgen.report.ModelVariable.customizeReport
er
Class: slreportgen.report.ModelVariable
Package: slreportgen.report
Syntax
reporter = slreportgen.report.ModelVariable.customizeReporter(classpath)
Description
reporter = slreportgen.report.ModelVariable.customizeReporter(classpath)
creates a class definition file that defines a subclass of slreportgen.report.ModelVariable at
the location specified by classpath. This method also copies the default reporter templates to the
resources/templates subfolder of the folder that contains the class definition file. You can use the
class definition file as a starting point to design a custom model variable reporter class for your
report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.ModelVariable.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.ModelVariable.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a model variable reporter in the myOrg package folder in the current
folder.
slreportgen.report.ModelVariable.customizeReporter("+myOrg/@MyClass");
Output Arguments
reporter — Path and file name of new model variable reporter class
string scalar
8-81
8 Functions
Path and file name of the new model variable reporter class, returned as a string scalar.
Examples
Create a custom model variable reporter, MyModelVariable, and its associated default templates in
the subfolder MyFolder of the current working folder.
slreportgen.report.ModelVariable.customizeReporter('MyFolder/MyModelVariable')
ans =
"MyFolder\MyModelVariable.m"
See Also
Simulink.VariableUsage | slreportgen.finder.ModelVariableFinder |
slreportgen.finder.ModelVariableResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
8-82
slreportgen.report.ModelVariable.getClassFolder
slreportgen.report.ModelVariable.getClassFolder
Class: slreportgen.report.ModelVariable
Package: slreportgen.report
Syntax
path = slreportgen.report.ModelVariable.getClassFolder()
Description
path = slreportgen.report.ModelVariable.getClassFolder() returns the path of the
folder that contains the slreportgen.report.ModelVariable class definition file.
Output Arguments
path — Location of the model variable reporter class definition file
character vector
Examples
Get the folder that contains the model variable reporter class definition.
path = slreportgen.report.ModelVariable.getClassFolder()
See Also
Simulink.VariableUsage | slreportgen.finder.ModelVariableResult |
slreportgen.finder.ModelVariableResult
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
8-83
8 Functions
getVariableName
Class: slreportgen.report.ModelVariable
Package: slreportgen.report
Syntax
name = getVariableName(reporter)
Description
name = getVariableName(reporter) returns the name of the model variable to be reported by
the specified model variable reporter.
Input Arguments
reporter — Model variable reporter
slreportgen.report.Modelvariable object
Output Arguments
name — Name of model variable
character vector
Examples
After you get the reporter for a model variable result, you can use the getVariableName method to
get the variable name from the reporter.
...
finder = slreportgen.finder.ModelVariableFinder(model);
while hasNext(finder)
result = next(finder);
8-84
getVariableName
end
...
See Also
slreportgen.finder.ModelVariableResult | slreportgen.report.ModelVariable |
slreportgen.finder.ModelVariableFinder
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
8-85
8 Functions
getVariableValue
Class: slreportgen.report.ModelVariable
Package: slreportgen.report
Syntax
value = getVariableValue(reporter)
Description
value = getVariableValue(reporter) returns the value of the model variable to be reported
by the specified model variable reporter.
Input Arguments
reporter — Model variable reporter
slreportgen.report.Modelvariable object
Examples
After you get the reporter for a model variable result, you can use the getVariableValue method
to get the variable value from the reporter.
...
finder = slreportgen.finder.ModelVariableFinder(model);
while hasNext(finder)
result = next(finder);
See Also
slreportgen.finder.ModelVariableResult | slreportgen.report.ModelVariable |
slreportgen.finder.ModelVariableFinder
8-86
getVariableValue
Topics
“Report Generation for Simulink and Stateflow Elements” on page 1-9
“What Is a Reporter?”
Introduced in R2019b
8-87
8 Functions
slreportgen.report.Notes.createTemplate
Class: slreportgen.report.Notes
Package: slreportgen.report
Syntax
template = slreportgen.report.Notes.createTemplate(templatePath,type)
Description
template = slreportgen.report.Notes.createTemplate(templatePath,type) creates a
copy of the slreportgen.report.Notes reporter template for the report type specified by type at
the location specified by templatePath. You can use the copy of the template as a starting point to
design a custom slreportgen.report.Notes template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is assigned based on the specified output type. For example, if type is 'pdf', the file
name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.Notes reporter and save it with
the name myNotesTemplate in the mytemplates folder.
template = slreportgen.report.Notes.createTemplate...
('mytemplates/myNotesTemplate','html');
8-88
slreportgen.report.Notes.createTemplate
Modify the template copy and then set the TemplateSrc property of the Notes reporter to the
template copy.
See Also
slreportgen.report.Notes | slreportgen.report.Report
Introduced in R2020a
8-89
8 Functions
slreportgen.report.RptFile.createTemplate
Class: slreportgen.report.RptFile
Package: slreportgen.report
Syntax
template = slreportgen.report.RptFile.createTemplate(templatePath,type)
Description
template = slreportgen.report.RptFile.createTemplate(templatePath,type) creates
a copy of the default Report Explorer-based reporter (RptFile) template specified by type at the
templatePath location . You can use the copied template as a starting point to design a custom
RptFile reporter template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create Report Explorer-based Reporter Template
Copy the template file of the desired output type. In this example the copied template file is named
myrptfile.htmtx and is saved in a folder named mytemplates. To use the new template for the
RptFile reporter, assign its path to the RptFile TemplateSrc property.
template = RptFile.createTemplate('mytemplates\myrptfile','html');
rptfile.TemplateSrc = template;
8-90
slreportgen.report.RptFile.createTemplate
See Also
slreportgen.report.RptFile | slreportgen.report.Report
Topics
“Modify Styles in a Microsoft Word Template”
“Modify Styles in HTML Templates”
“Modify Styles in PDF Templates”
Introduced in R2019a
8-91
8 Functions
slreportgen.report.Notes.customizeReporter
Class: slreportgen.report.Notes
Package: slreportgen.report
Syntax
reporter = slreportgen.report.Notes.customizeReporter(classpath)
Description
reporter = slreportgen.report.Notes.customizeReporter(classpath) creates a
reporter class definition file that defines a subclass of slreportgen.report.Notes at the location
specified by classpath. The method also copies the default reporter templates to the resources/
templates subfolder of the folder that contains the class definition file. You can use the class
definition file as a starting point to design a custom notes reporter class for your report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.Notes.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.Notes.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a notes reporter in the myOrg package folder in the current folder.
slreportgen.report.Notes.customizeReporter("+myOrg/@MyClass")
Output Arguments
reporter — Path and file name of new reporter class
string scalar
Path and file name of the new reporter class, returned as a string scalar.
8-92
slreportgen.report.Notes.customizeReporter
Examples
Create a custom notes reporter, myNotes, and the associated default templates in the subfolder
MyFolder of the current working folder.
slreportgen.report.Notes.customizeReporter("MyFolder/myNotes")
ans =
"MyFolder\myNotes.m"
See Also
slreportgen.report.Notes | slreportgen.report.Report
Introduced in R2020a
8-93
8 Functions
slreportgen.report.Notes.getClassFolder
Class: slreportgen.report.Notes
Package: slreportgen.report
Get location of folder that contains slreportgen.report.Notes reporter class definition file
Syntax
path = slreportgen.report.Notes.getClassFolder()
Description
path = slreportgen.report.Notes.getClassFolder() returns the path of the folder that
contains the slreportgen.report.Notes class definition file.
Output Arguments
path — slreportgen.report.Notes class definition file location
character vector
Examples
Get the location of the folder that contains the notes reporter class definition.
path = slreportgen.report.Notes.getClassFolder()
See Also
slreportgen.report.Notes | slreportgen.report.Report
Introduced in R2020a
8-94
copy
copy
Class: slreportgen.report.Reporter
Package: slreportgen.report
Create copy of a Simulink reporter object and make deep copies of certain property values
Syntax
reporterObj2 = copy(reporterObj1)
Description
reporterObj2 = copy(reporterObj1) returns a copy of the specified reporter object. The
returned copy contains a “deep copy” on page 8-96 of any property value of reporterObj1 that
references a reporter or DOM object. As a result, the corresponding property value in
reporterObj2 refers to a new, independent object. You can modify the properties of the original or
new object without affecting the other object.
Input Arguments
reporterObj1 — Reporter to copy
reporter object
Output Arguments
reporterObj2 — Copy of reporter
reporter object
Examples
This example copies a DocBlock reporter to show the effect of a deep copy operation on a reporter
property. Modifying a property of the Text object in the TextFormatter property of the copy of the
DocBlock object does not affect the original DocBlock object.
Load a model.
import slreportgen.report.*
model_name = "slrgex_fuelsys";
load_system(model_name);
docBlock = "slrgex_fuelsys/To Controller/Sensor Info";
8-95
8 Functions
rptr1 = DocBlock(docBlock);
The Bold property of the Text object referenced by the TextFormatter property of the reporter is
empty.
rptr1.TextFormatter.Bold
ans =
[]
Copy the DocBlock object. In the copy, set the Bold property of the Text object referenced by the
TextFormatter property to true.
rptr2 = copy(rptr1);
rptr2.TextFormatter.Bold = true;
rptr2.TextFormatter.Bold
ans = logical
1
In the original DocBlock object, the Bold property of the object referenced by the TextFormatter
property is still empty.
rptr1.TextFormatter.Bold
ans =
[]
More About
reporter class
deep copy
To make a deep copy of a handle object, the copy operation recursively copies property values that
are handles to objects so that all of the underlying data is copied. By contrast, with a shallow copy,
the copy operation copies the handle. The underlying data is not copied. When you copy a reporter,
the copy operation makes a deep copy of any property value that is a reporter object, or a DOM
object.
See Also
slreportgen.report.Reporter
Introduced in R2021a
8-96
slreportgen.report.Reporter.createTemplate
slreportgen.report.Reporter.createTemplate
Class: slreportgen.report.Reporter
Package: slreportgen.report
Syntax
template = slreportgen.report.Reporter.createTemplate(templatePath,type)
Description
template = slreportgen.report.Reporter.createTemplate(templatePath,type)
creates a copy of the slreportgen.report.Reporter template for the report type specified by
type at the location specified by templatePath. You can use the copied template as a starting point
to design a custom reporter template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.Reporter class and save it with
the name myTemplate in the mytemplates folder.
template = slreportgen.report.Reporter.createTemplate...
('mytemplates/myTemplate','html');
8-97
8 Functions
After you modify the template, you can use it by setting the TemplateSrc property of a reporter to
the path of the template file.
See Also
slreportgen.report.Reporter | slreportgen.report.Report
Introduced in R2021a
8-98
slreportgen.report.Reporter.customizeReporter
slreportgen.report.Reporter.customizeReporter
Class: slreportgen.report.Reporter
Package: slreportgen.report
Syntax
reporter = slreportgen.report.Reporter.customizeReporter(classpath)
Description
reporter = slreportgen.report.Reporter.customizeReporter(classpath) creates a
reporter class definition file that defines a subclass of slreportgen.report.Reporter at the
location specified by classpath. The method also copies the default reporter templates to the
resources/templates subfolder of the folder that contains the class definition file. You can use the
class definition file as a starting point to design a custom reporter class.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.Reporter.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.Reporter.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a reporter in the myOrg package folder in the current folder.
slreportgen.report.Reporter.customizeReporter("+myOrg/@MyClass")
Output Arguments
reporter — Path and file name of new reporter class
string scalar
Path and file name of the new reporter class, returned as a string scalar.
8-99
8 Functions
Examples
Create a custom reporter, myReporter, and the associated default templates in the subfolder
MyFolder of the current working folder.
slreportgen.report.Reporter.customizeReporter("MyFolder/myReporter")
ans =
"MyFolder\myReporter.m"
See Also
Introduced in R2021a
8-100
slreportgen.report.Reporter.getClassFolder
slreportgen.report.Reporter.getClassFolder
Class: slreportgen.report.Reporter
Package: slreportgen.report
Syntax
path = slreportgen.report.Reporter.getClassFolder()
Description
path = slreportgen.report.Reporter.getClassFolder() returns the path of the folder that
contains the slreportgen.report.Reporter class definition file.
Output Arguments
path — slreportgen.report.Reporter class definition file location
character vector
Examples
Get the location of the folder that contains the slreportgen.report.Reporter class definition
file.
path = slreportgen.report.Reporter.getClassFolder()
See Also
slreportgen.report.Reporter | slreportgen.report.Report
Introduced in R2021a
8-101
8 Functions
getImpl
Class: slreportgen.report.Reporter
Package: slreportgen.report
Syntax
impl = getImpl(reporter,report)
Description
impl = getImpl(reporter,report) returns the DOM object used to implement this reporter in
the specified report. The implementation object can help you debug report generation problems.
Input Arguments
reporter — Reporter
slreportgen.report.Reporter object | object of subclass of slreportgen.report.Reporter
report — Report
slreportgen.report.Report object
Output Arguments
impl — Implementation object
DOM object
Examples
This example shows how to use getImpl to obtain the DOM object used to create a diagram reporter.
You can use the getImpl method with any type of reporter.
load_system("slrgex_vdp")
import slreportgen.report.*
import mlreportgen.report.*
rpt = slreportgen.report.Report("output","pdf");
8-102
getImpl
chapter = Chapter();
chapter.Title = "Diagram Reporter Example";
diagram = Diagram("slrgex_vdp");
diagram.Snapshot.Caption = "The van der Pol Equation";
diagram.SnapshotFormat = "svg";
diagram.Snapshot.Height = "4in";
getImpl(diagram,rpt)
close(rpt);
See Also
slreportgen.report.Reporter
Introduced in R2021a
8-103
8 Functions
slreportgen.report.RptFile.customizeReporter
Class: slreportgen.report.RptFile
Package: slreportgen.report
Syntax
reporter = slreportgen.report.RptFile.customizeReporter(classpath)
Description
reporter = slreportgen.report.RptFile.customizeReporter(classpath) creates a
Report Explorer-based reporter (RptFile) class definition file that is a subclass of
slreportgen.report.RptFile. The file is created at the specified classpath location. The
RptFile.customizeReporter method also copies the default RptFile templates to the
<classpath>/resources/template folder. You can use the new class definition file as a starting
point to design a custom Report Explorer-based reporter class for your report.
Input Arguments
classpath — Location of custom Report Explorer-based reporter class
current working folder (default) | string | character array
Location of custom Report Explorer-based reporter class, specified as a string or character array. The
classpath argument also supports specifying a folder with @ before the class name.
Output Arguments
reporter — Report Explorer-based reporter path
string
Report Explorer-based reporter path, returned as a string specifying the path to the derived report
class file.
Examples
Create Custom Report Explorer-based Reporter
Create a custom Report Explorer-based reporter and its associated default templates. In this
example, the derived class file is created at the specified path under the current working folder. In
this example, the path to the MyRptExplRptr.m class file is <current working folder>/
new_rptexpl_rptr/@MyRptExplRptr/MyRptExplRptr.m. The default RptFile templates are in
the <current working folder>/new_rptexpl_rptr/@RptExplRptr/resources/templates
folder.
import slreportgen.report.*
RptFile.customizeReporter('new_rptexpl_rptr/@MyRptExplRptr');
8-104
slreportgen.report.RptFile.customizeReporter
After editing this new class file, you can use it as your RptFile reporter.
rptr = MyRptExplRptr();
See Also
slreportgen.report.RptFile | slreportgen.report.Report
Introduced in R2019a
8-105
8 Functions
slreportgen.report.RptFile.getClassFolder
Class: slreportgen.report.RptFile
Package: slreportgen.report
Syntax
path = slreportgen.report.RptFile.getClassFolder()
Description
path = slreportgen.report.RptFile.getClassFolder() returns the path of the folder that
contains the Report Explorer-based reporter class definition file.
Output Arguments
path — Report Explorer-based reporter class definition file location
character array
Report Explorer-based reporter class definition file location, returned as a character array.
See Also
slreportgen.report.RptFile | slreportgen.report.Report
Introduced in R2019a
8-106
slreportgen.report.Signal.createTemplate
slreportgen.report.Signal.createTemplate
Class: slreportgen.report.Signal
Package: slreportgen.report
Syntax
template = slreportgen.report.Signal.createTemplate(templatePath,type)
Description
template = slreportgen.report.Signal.createTemplate(templatePath,type) creates a
copy of the slreportgen.report.Signal reporter template for the report type specified by type
at the location specified by templatePath. You can use the copied template as a starting point to
design a custom signal reporter template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.Signal reporter and save it
with the name mySignalTemplate in the mytemplates folder.
template = slreportgen.report.Signal.createTemplate...
('mytemplates/mySignalTemplate','html');
8-107
8 Functions
After you modify the template, you can use it by setting the TemplateSrc property of a Signal
reporter to the path of the template file.
See Also
slreportgen.report.Report | slreportgen.report.Signal
Introduced in R2021a
8-108
slreportgen.report.Signal.customizeReporter
slreportgen.report.Signal.customizeReporter
Class: slreportgen.report.Signal
Package: slreportgen.report
Syntax
reporter = slreportgen.report.Signal.customizeReporter(classpath)
Description
reporter = slreportgen.report.Signal.customizeReporter(classpath) creates a
reporter class definition file that defines a subclass of slreportgen.report.Signal at the location
specified by classpath. The method also copies the default reporter templates to the resources/
templates subfolder of the folder that contains the class definition file. You can use the class
definition file as a starting point to design a custom signal reporter class for your report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of the new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.Signal.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.Signal.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a signal reporter in the myOrg package folder in the current folder.
slreportgen.report.Signal.customizeReporter("+myOrg/@MyClass")
Output Arguments
reporter — Path and file name of new reporter class
string scalar
Path and file name of the new reporter class, returned as a string scalar.
8-109
8 Functions
Examples
Create a custom signal reporter, mySignal, and the associated default templates in the subfolder
MyFolder of the current working folder.
slreportgen.report.Signal.customizeReporter("MyFolder/mySignal")
ans =
"MyFolder\mySignal.m"
See Also
slreportgen.report.Report | slreportgen.report.Signal
Introduced in R2021a
8-110
slreportgen.report.Signal.getClassFolder
slreportgen.report.Signal.getClassFolder
Class: slreportgen.report.Signal
Package: slreportgen.report
Syntax
path = slreportgen.report.Signal.getClassFolder()
Description
path = slreportgen.report.Signal.getClassFolder() returns the path of the folder that
contains the slreportgen.report.Signal class definition file.
Output Arguments
path — slreportgen.report.Signal class definition file location
character vector
Examples
Get the location of the folder that contains the signal reporter class definition file.
path = slreportgen.report.Signal.getClassFolder()
See Also
slreportgen.report.Report | slreportgen.report.Signal
Introduced in R2021a
8-111
8 Functions
slreportgen.report.SimulinkObjectProperties.creat
eTemplate
Class: slreportgen.report.SimulinkObjectProperties
Package: slreportgen.report
Syntax
template = slreportgen.report.SimulinkObjectProperties.createTemplate(
templatePath,type)
output_args = createTemplate(input_args,Name,Value)
Description
template = slreportgen.report.SimulinkObjectProperties.createTemplate(
templatePath,type) creates a copy of the default Simulink object properties template specified by
type at the location specified by templatePath. To design a custom Simulink object properties
template for your report, use the copied template as a starting point t.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
8-112
slreportgen.report.SimulinkObjectProperties.createTemplate
Examples
Create a Report Template
template = slreportgen.report.SimulinkObjectProperties.createTemplate...
('mytemplates\mySimulinkObjectPropertiesTemplate','html');
See Also
slreportgen.report.SimulinkObjectProperties
Topics
“Modify Styles in a Microsoft Word Template”
“Modify Styles in HTML Templates”
“Modify Styles in PDF Templates”
Introduced in R2017b
8-113
8 Functions
slreportgen.report.SimulinkObjectProperties.custo
mizeReporter
Class: slreportgen.report.SimulinkObjectProperties
Package: slreportgen.report
Syntax
reporter = slreportgen.report.SimulinkObjectProperties.customizeReporter(
classpath)
Description
reporter = slreportgen.report.SimulinkObjectProperties.customizeReporter(
classpath) creates a Simulink object properties page class definition file that is a subclass of
slreportgen.report.SimulinkObjectProperties. The file is created at the specified
classpath location. The SimulinkObjectProperties.customizeReporter method also copies
the default Simulink object properties templates to the <classpath>/resources/template folder.
To design a custom Simulink object properties class for your report, use the new class definition file
as a starting point.
Input Arguments
classpath — Location of custom Simulink object properties class
current working folder (default) | string | character array
Location of custom Simulink object properties class, specified as a string or character array. The
classpath argument also supports specifying a folder with @ before the class name.
Output Arguments
reporter — Simulink object properties reporter path
string
Simulink object properties reporter path, returned as the string specifying the path to the derived
report class file.
Examples
Create Custom Simulink Object Properties Reporter
Create a custom Simulink object properties reporter and its associated default templates. The derived
class file is created at the specified path relative to the current working folder. In this case, the path
to the MySFObjProps.m class file is <current working folder>/newSFObjProps/
8-114
slreportgen.report.SimulinkObjectProperties.customizeReporter
@MySFObjProps/MySFObjProps.m. The default title page templates are in the <current working
folder>/newTitlePage/@MySFObjProps/resources/templates folder.
import slreportgen.report.*
StateflowObjectProperties.customizeReporter...
('newSFObjProps/@MySFObjProps');
After editing this new class file, you can use it as your Simulink object properties reporter.
objprop = MySFObjProps();
See Also
slreportgen.report.SimulinkObjectProperties | slreportgen.report.Report
Introduced in R2017b
8-115
8 Functions
slreportgen.report.SimulinkObjectProperties.getCl
assFolder
Class: slreportgen.report.SimulinkObjectProperties
Package: slreportgen.report
Syntax
path =
getClassFolderslreportgen.report.SimulinkObjectProperties.getClassFolder()
Description
path =
getClassFolderslreportgen.report.SimulinkObjectProperties.getClassFolder()
returns the path of the folder that contains the Simulink object properties class definition file.
Output Arguments
path — Simulink object properties class definition file location
character array
Simulink object properties class definition file location, returned as a character array.
See Also
slreportgen.report.SimulinkObjectProperties | slreportgen.report.Report
Introduced in R2017b
8-116
slreportgen.report.StateflowObjectProperties.createTemplate
slreportgen.report.StateflowObjectProperties.crea
teTemplate
Class: slreportgen.report.StateflowObjectProperties
Package: slreportgen.report
Syntax
template = slreportgen.report.StateflowObjectProperties.createTemplate(
templatePath,type)
Description
template = slreportgen.report.StateflowObjectProperties.createTemplate(
templatePath,type) creates a copy of the default Stateflow object properties template specified
by type at the location specified by templatePath. Use the copied template as a starting point to
design a custom Stateflow object properties template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a Report Template
8-117
8 Functions
template = slreportgen.report.StateflowObjectProperties.createTemplate...
('mytemplates\myStateflowObjectPropertiesTemplate','html');
See Also
slreportgen.report.StateflowObjectProperties
Introduced in R2017b
8-118
slreportgen.report.StateflowObjectProperties.customizeReporter
slreportgen.report.StateflowObjectProperties.cust
omizeReporter
Class: slreportgen.report.StateflowObjectProperties
Package: slreportgen.report
Syntax
reporter = slreportgen.report.StateflowObjectProperties.customizeReporter(
classpath)
Description
reporter = slreportgen.report.StateflowObjectProperties.customizeReporter(
classpath) creates a Stateflow object properties page class definition file that is a subclass of
slreportgen.report.SimulinkObjectProperties. The file is created at the specified
classpath location. The SimulinkObjectProperties.customizeReporter method also copies
the default Stateflow object properties templates to the <classpath>/resources/template
folder. To design a custom Stateflow object properties class for your report, use the new class
definition file as a starting point.
Input Arguments
classpath — Location of custom Stateflow object properties class
current working folder (default) | string | character array
Location of custom Stateflow object properties class, specified as a string or character array. The
classpath argument also supports specifying a folder with @ before the class name.
Output Arguments
reporter — Stateflow object properties reporter path
string
Stateflow object properties reporter path, returned as the string specifying the path to the derived
report class file.
Examples
Create Custom Stateflow Object Properties Reporter
Create a custom Stateflow object properties reporter and its associated default templates. The
derived class file is created at the specified path relative to the current working folder. In this case,
the path to the MySFObjProps.m class file is <current working folder>/newSFObjProps/
@MySFObjProps/MySFObjProps.m. The default title page templates are in the <current working
folder>/newTitlePage/@MySFObjProps/resources/templates folder.
8-119
8 Functions
import slreportgen.report.*
StateflowObjectProperties.customizeReporter...
('newSFObjProps/@MySFObjProps');
After editing this new class file, you can use it as your Stateflow object properties reporter.
objprop = MySFObjProps();
See Also
slreportgen.report.StateflowObjectProperties | slreportgen.report.Report
Introduced in R2017b
8-120
slreportgen.report.StateflowObjectProperties.getClassFolder
slreportgen.report.StateflowObjectProperties.getC
lassFolder
Class: slreportgen.report.StateflowObjectProperties
Package: slreportgen.report
Syntax
path = slreportgen.report.StateflowObjectProperties.getClassFolder()
Description
path = slreportgen.report.StateflowObjectProperties.getClassFolder() returns the
path of the folder that contains the Stateflow object properties class definition file.
Output Arguments
path — Stateflow object properties class definition file location
character array
Stateflow object properties class definition file location, returned as a character array.
See Also
slreportgen.report.StateflowObjectProperties | slreportgen.report.Report
Introduced in R2017b
8-121
8 Functions
slreportgen.report.SystemHierarchy.createTemplat
e
Class: slreportgen.report.SystemHierarchy
Package: slreportgen.report
Syntax
template = slreportgen.report.SystemHierarchy.createTemplate(templatePath,
type)
Description
template = slreportgen.report.SystemHierarchy.createTemplate(templatePath,
type) creates a copy of the slreportgen.report.SystemHierarchy reporter template for the
report type specified by type at the location specified by templatePath. You can use the copied
template as a starting point to design a custom system hierarchy template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the system hierarchy reporter and save it with the name
mySysHierarchyTemplate in the mytemplates folder.
8-122
slreportgen.report.SystemHierarchy.createTemplate
template = slreportgen.report.SystemHierarchy.createTemplate...
('mytemplates/mySysHierarchyTemplate','html');
After you modify the template, you can use it by setting the TemplateSrc property of the reporter.
See Also
slreportgen.report.SystemHierarchy | slreportgen.report.Report
Introduced in R2019b
8-123
8 Functions
slreportgen.report.SystemHierarchy.customizeRep
orter
Class: slreportgen.report.SystemHierarchy
Package: slreportgen.report
Syntax
reporter = slreportgen.report.SystemHierarchy.customizeReporter(classpath)
Description
reporter = slreportgen.report.SystemHierarchy.customizeReporter(classpath)
creates a class definition file that defines a subclass of slreportgen.report.SystemHierarchy
at the location specified by classpath. This method also copies the default reporter templates to the
resources/templates subfolder of the folder that contains the class definition file. You can use the
class definition file as a starting point to design a custom system hierarchy reporter class for your
report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.SystemHierarchy.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass of the current folder.
slreportgen.report.SystemHierarchy.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a system hierarchy reporter in the myOrg package folder in the current
folder.
slreportgen.report.SystemHierarchy.customizeReporter("+myOrg/@SystemHierarchy");
Output Arguments
reporter — Path to new system hierarchy reporter class
string scalar
8-124
slreportgen.report.SystemHierarchy.customizeReporter
Path and file name of the new system hierarchy reporter class, returned as a string scalar.
Examples
Create a custom system hierarchy reporter class, MySystemHierarchy, and its associated default
templates in the subfolder MyFolder of the current working folder.
slreportgen.report.SystemHierarchy.customizeReporter('MyFolder/MySystemHierarchy')
ans =
"MyFolder\MySystemHierarchy.m"
After editing this new class file, you can use it as your system hierarchy reporter.
rptr = MySystemHierarchy;
See Also
slreportgen.report.SystemHierarchy | slreportgen.report.Report
Introduced in R2019b
8-125
8 Functions
slreportgen.report.SystemHierarchy.getClassFolde
r
Class: slreportgen.report.SystemHierarchy
Package: slreportgen.report
Syntax
path = slreportgen.report.SystemHierarchy.getClassFolder()
Description
path = slreportgen.report.SystemHierarchy.getClassFolder() returns the path of the
folder that contains the slreportgen.report.SystemHierarchy class definition file.
Output Arguments
path — Location of the system hierarchy reporter class definition file
character vector
Examples
Get the location of the folder that contains the system hierarchy reporter class definition.
path = slreportgen.report.SystemHierarchy.getClassFolder()
See Also
slreportgen.report.SystemHierarchy | slreportgen.report.Report
Introduced in R2019b
8-126
slreportgen.report.SystemIO.createTemplate
slreportgen.report.SystemIO.createTemplate
Class: slreportgen.report.SystemIO
Package: slreportgen.report
Syntax
template = slreportgen.report.SystemIO.createTemplate(templatePath,type)
Description
template = slreportgen.report.SystemIO.createTemplate(templatePath,type)
creates a copy of the slreportgen.report.SystemIO reporter template for the report type
specified by type at the location specified by templatePath. You can use the copy of the template
as a starting point to design a custom slreportgen.report.SystemIO template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.SystemIO reporter and save it
with the name mySystemIOTemplate in the mytemplates folder.
template = slreportgen.report.SystemIO.createTemplate...
('mytemplates/mySystemIOTemplate','html');
8-127
8 Functions
After you modify the template, you can use it by setting the TemplateSrc property of the reporter.
See Also
slreportgen.report.Report | slreportgen.report.SystemIO
Introduced in R2020a
8-128
slreportgen.report.SystemIO.customizeReporter
slreportgen.report.SystemIO.customizeReporter
Class: slreportgen.report.SystemIO
Package: slreportgen.report
Syntax
reporter = slreportgen.report.SystemIO.customizeReporter(classpath)
Description
reporter = slreportgen.report.SystemIO.customizeReporter(classpath) creates a
reporter class definition file that defines a subclass of slreportgen.report.SystemIO at the
location specified by classpath. The method also copies the default reporter templates to the
resources/templates subfolder of the folder that contains the class definition file. You can use the
class definition file as a starting point to design a custom system input and output reporter class for
your report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.SystemIO.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.SystemIO.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a system input and output reporter in the myOrg package folder in the
current folder.
slreportgen.report.SystemIO.customizeReporter("+myOrg/@MyClass")
Output Arguments
reporter — Path and file name of new reporter class
string scalar
Path and file name of the new reporter class, returned as a string scalar.
8-129
8 Functions
Examples
Create a custom system input and output reporter, mySystemIO, and the associated default
templates in the subfolder MyFolder of the current working folder.
slreportgen.report.SystemIO.customizeReporter('MyFolder/mySystemIO')
ans =
"MyFolder\mySystemIO.m"
See Also
slreportgen.report.Report | slreportgen.report.SystemIO
Introduced in R2020a
8-130
slreportgen.report.SystemIO.getClassFolder
slreportgen.report.SystemIO.getClassFolder
Class: slreportgen.report.SystemIO
Package: slreportgen.report
Get location of folder that contains the slreportgen.report.SystemIO class definition file
Syntax
path = slreportgen.report.SystemIO.getClassFolder()
Description
path = slreportgen.report.SystemIO.getClassFolder() returns the path of the folder that
contains the slreportgen.report.SystemIO class definition file.
Output Arguments
path — slreportgen.report.SystemIO class definition file location
character vector
Examples
Get the location of the folder that contains the system input and output reporter class definition.
path = slreportgen.report.SystemIO.getClassFolder()
See Also
slreportgen.report.Report | slreportgen.report.SystemIO
Introduced in R2020a
8-131
8 Functions
slreportgen.report.TestSequence.createTemplate
Class: slreportgen.report.TestSequence
Package: slreportgen.report
Syntax
template = slreportgen.report.TestSequence.createTemplate(templatePath,type)
Description
template = slreportgen.report.TestSequence.createTemplate(templatePath,type)
creates a copy of the slreportgen.report.TestSeqeunce reporter template for the report type
specified by type at the location specified by templatePath. You can use the copied template as a
starting point to design a custom Test Sequence block reporter template for your report.
Input Arguments
templatePath — Path and file name of new template
character vector | string scalar
Path and file name of the new template, specified as a character vector or string scalar.
Output Arguments
template — Path and file name of template copy
string scalar
Path and file name of the copy of the template, returned as a string scalar. The file name extension of
the template is based on the specified template type. For example, if the type argument is 'pdf',
the file name extension is .pdftx.
Examples
Create a copy of the HTML template for the slreportgen.report.TestSequence reporter and
save it with the name myTestSequenceTemplate in the mytemplates folder.
template = slreportgen.report.TestSequence.createTemplate...
('mytemplates/myTestSequenceTemplate','html');
8-132
slreportgen.report.TestSequence.createTemplate
After you modify the template, you can use it by setting the TemplateSrc property of a
TestSequence reporter to the path of the template file.
See Also
slreportgen.report.TestSequence
Introduced in R2020b
8-133
8 Functions
slreportgen.report.TestSequence.customizeReport
er
Class: slreportgen.report.TestSequence
Package: slreportgen.report
Syntax
reporter = slreportgen.report.TestSequence.customizeReporter(classpath)
Description
reporter = slreportgen.report.TestSequence.customizeReporter(classpath) creates
a class definition file that defines a subclass of slreportgen.report.TestSequence at the
location specified by classpath. This method also copies the default reporter templates to the
resources/templates subfolder of the folder that contains the class definition file. You can use the
class definition file as a starting point to design a custom Test Sequence block reporter class for your
report.
Input Arguments
classpath — Path and name of new class definition file
string scalar | character vector
Path and name of new class definition file, specified as a string scalar or character vector.
You can specify a relative path or an absolute path. For example, this code creates MyClass.m in the
subfolder myFolder of the current folder.
slreportgen.report.TestSequence.customizeReporter("myFolder/MyClass")
To create the reporter class in a class folder, precede the class name with the @ character. Do not
specify the .m extension. For example, this code creates MyClass.m in the subfolder myFolder/
@MyClass in the current folder.
slreportgen.report.TestSequence.customizeReporter("myFolder/@MyClass")
To create the reporter class in a class package, precede the folder name with the + character. For
example, this code creates a Test Sequence block reporter in the myOrg package folder in the current
folder.
slreportgen.report.TestSequence.customizeReporter("+myOrg/@MyClass");
Output Arguments
reporter — Path and file name of new Test Sequence block reporter class
string scalar
8-134
slreportgen.report.TestSequence.customizeReporter
Path and file name of the new Test Sequence block reporter class, returned as a string scalar.
Examples
Create a custom Test Sequence block reporter, MyTestSequence, and its associated default
templates in the subfolder MyFolder of the current working folder.
slreportgen.report.TestSequence.customizeReporter('MyFolder/MyTestSequence')
ans =
"MyFolder\MyTestSequnce.m"
See Also
slreportgen.report.TestSequence
Introduced in R2020b
8-135
8 Functions
slreportgen.report.TestSequence.getClassFolder
Class: slreportgen.report.TestSequence
Package: slreportgen.report
Syntax
path = slreportgen.report.TestSequence.getClassFolder()
Description
path = slreportgen.report.TestSequence.getClassFolder() returns the path of the folder
that contains the slreportgen.report.TestSequence class definition file.
Output Arguments
path — Location of the Test Sequence block reporter class definition file
character vector
Examples
Get the folder that contains the Test Sequence block reporter class definition.
path = slreportgen.report.TestSequence.getClassFolder()
See Also
slreportgen.report.TestSequence
Introduced in R2020b
8-136
slreportgen.report.TruthTable.createTemplate
slreportgen.report.TruthTable.createTemplate
Class: slreportgen.report.TruthTable
Package: slreportgen.report
Syntax
template = slreportgen.report.TruthTable.createTemplate(templatePath,type)
Description
template = slreportgen.report.TruthTable.createTemplate(templatePath,type)
creates a copy of the default TruthTable reporter template specified by type at the location
specified by templatePath. To design a custom truth table template for your report, use the copied
template as a starting point.
Input Arguments
templatePath — Location of reporter template
string | character vector | character array | template source object
Location of the reporter template, specified as a character vector, character array, or template source
object.
Output Arguments
template — Template name
string
Name of template, returned as the path and file name of the template. The template file name
extension is assigned based on the specified output type. For example, for PDF output, the template
name has a .pdftx file extension.
Examples
Create a Truth Table Template
template = slreportgen.report.TruthTable.createTemplate...
('mytemplates\myTruthTable','html');
See Also
slreportgen.report.Report | slreportgen.report.TruthTable
8-137
8 Functions
Introduced in R2018b
8-138
slreportgen.report.TruthTable.customizeReporter
slreportgen.report.TruthTable.customizeReporter
Class: slreportgen.report.TruthTable
Package: slreportgen.report
Syntax
customRptrPath = slreportgen.report.TruthTable.customizeReporter(classpath)
Description
customRptrPath = slreportgen.report.TruthTable.customizeReporter(classpath)
creates an empty truth table class definition file that is a subclass of
slreportgen.report.TruthTable. The file is created at the specified classpath location. The
customizeReporter method also copies the default truth table templates to the <classpath>/
resources/template folder. To design a custom truth table class for your report, you can use the
new class definition file as a starting point.
Input Arguments
classpath — Location of custom truth table class
current working folder (default) | string | character array
Location of custom truth table class, specified as a string or character array. The classpath
argument also supports specifying a folder with @ before the class name. For example, both of these
paths are valid:
• slreportgen.report.TruthTable.customizeReporter("path_folder/MyClassA.m")
• slreportgen.report.TruthTable.customizeReporter("+package/@MyClassB")
Output Arguments
customRptrPath — Path of custom truth table reporter
string
Path of the class definition file that defines the custom truth table reporter, specified as a string.
Examples
Create Custom Truth Table Reporter
Create a custom TruthTable reporter and its associated default templates. The derived class file is
created at the specified path relative to the current working folder. In this case, the path to the
MyTruthTable.m class file is <current working folder>/newTruthTable/@MyTruthTable/
MyTruthTable.m. The default diagram templates are in the <current working folder>/
newTruthTable/@MyTruthTable/resources/templates folder.
slreportgen.report.TruthTable.customizeReporter('newTruthTable/@MyTruthTable');
8-139
8 Functions
See Also
slreportgen.report.Report | slreportgen.report.TruthTable
Introduced in R2018b
8-140
slreportgen.report.TruthTable.getClassFolder
slreportgen.report.TruthTable.getClassFolder
Class: slreportgen.report.TruthTable
Package: slreportgen.report
Syntax
path = slreportgen.report.TruthTable.getClassFolder()
Description
path = slreportgen.report.TruthTable.getClassFolder() returns the path of the folder
that contains the truth table class definition file.
Output Arguments
path — Truth table class definition file location
character array
See Also
slreportgen.report.Report | slreportgen.report.TruthTable
Introduced in R2018b
8-141
8 Functions
slreportgen.utils.block2chart
Package: slreportgen.utils
Syntax
charts = slreportgen.utils.block2chart(subsystems)
Description
charts = slreportgen.utils.block2chart(subsystems) returns an array of Stateflow chart
objects that are contained in the specified subsystems.
Examples
Obtain Chart Object
load_system("slrgex_fuelsys_fuel_rate_control")
slreportgen.utils.block2chart...
("slrgex_fuelsys_fuel_rate_control/control_logic")
Input Arguments
subsystems — Subsystem blocks
array of subsystem block handles | array of paths to subsystem blocks
Subsystem blocks, specified as an array of subsystem block handles or an array of handles or paths to
the subsystem blocks.
Output Arguments
charts — Stateflow chart objects
array of Stateflow chart objects
Stateflow chart objects, returned as an array. The returned Stateflow charts are contained in the
specified subsystems.
See Also
slreportgen.utils.getSlSfHandle
Introduced in R2018b
8-142
slreportgen.utils.compileModel
slreportgen.utils.compileModel
Package: slreportgen.utils
Compile model
Syntax
slreportgen.utils.compileModel(modelname)
Description
slreportgen.utils.compileModel(modelname) compiles the model specified in the
modelname input. If modelname is a Simulink block or Stateflow object, the model that contains the
block or object is compiled.
Input Arguments
modelname — Model to compile
character array | string
Model to compile, specified as a character array or string of the model handle, block handle, or
Stateflow object. If modelname is an element in the model or chart, this utility compiles the
containing model or chart.
See Also
slreportgen.utils.isModelCompiled | slreportgen.utils.uncompileModel
Introduced in R2018b
8-143
8 Functions
slreportgen.utils.getCurrentEditorView
Get current editor view area
Syntax
viewArea = slreportgen.utils.getCurrentEditorView()
Description
viewArea = slreportgen.utils.getCurrentEditorView() returns the current Simulink
Editor view area as a 1-by-4 array of doubles. The first two values of the array are the x and y
coordinates, in pixels, of the top left corner of the diagram area in the Simulink Editor coordinate
space. The last two values are the width and height, in pixels.
Examples
f14
In the Simulink Editor, zoom in on the area of the diagram that you want to capture in the report.
Set up the report and create an slreportgen.report.Diagram reporter to take a snapshot of the
top-level diagram. Specify that you want to capture the current editor view in the diagram snapshot.
import slreportgen.report.*
import slreportgen.utils.*
rpt = Report('output','pdf');
diag = Diagram('f14');
diag.SnapshotArea = getCurrentEditorView();
add(rpt,diag);
close(rpt);
rptview(rpt);
See Also
slreportgen.report.Diagram
Introduced in R2020a
8-144
slreportgen.utils.getDisplayIcon
slreportgen.utils.getDisplayIcon
Package: slreportgen.utils
Syntax
displayIcon = slreportgen.utils.getDisplayIcon(obj)
Description
displayIcon = slreportgen.utils.getDisplayIcon(obj) returns the icon image file name
for a Simulink handle or Stateflow object.
Examples
Get Icon Path for Stateflow Chart
load_system('slrgex_sf_car')
chart = find(slroot,'-isa',...
'Stateflow.Chart','Name','shift_logic');
iconPath = slreportgen.utils.getDisplayIcon(chart);
Input Arguments
obj — Simulink or Stateflow object
string | character array
Simulink handle or Stateflow object, specified as a string or character array of its path or handle.
Output Arguments
displayIcon — Icon image file name
string
See Also
Introduced in R2018b
8-145
8 Functions
slreportgen.utils.getModelHandle
Package: slreportgen.utils
Syntax
modelHandle = slreportgen.utils.getModelHandle(obj)
Description
modelHandle = slreportgen.utils.getModelHandle(obj) returns the handle of a Simulink
model or Stateflow object.
Examples
Obtain Simulink Model Handle
load_system('f14')
modelHandle_blk = slreportgen.utils.getModelHandle('f14/Controller')
modelHandle_blk =
2.0002
Input Arguments
obj — Simulink or Stateflow object
string | character array
Simulink or Stateflow object, specified as a string or character array of the object path or object
handle. This utility returns the handle of the specified model or chart. If you specify an element in the
model or chart, this utility returns the handle of the containing model or chart.
Output Arguments
modelHandle — Model handle
double
See Also
slreportgen.utils.getSlSfHandle
8-146
slreportgen.utils.getModelHandle
Introduced in R2018b
8-147
8 Functions
slreportgen.utils.getObjectID
Package: slreportgen.utils
Syntax
id = slreportgen.utils.getObjectID(obj)
id = slreportgen.utils.getObjectID(obj,"Hash",false)
Description
id = slreportgen.utils.getObjectID(obj) generates a link target ID for the specified
Simulink or Stateflow object. The ID is hashed so that it does not exceed the 40-character limit
imposed on Microsoft Word bookmarks.
To create a link target for a Truth Table block in a Simulink diagram, specify the Truth Table block
path and not the Stateflow.TruthTable object.
Examples
Obtain Object ID from Handle
load_system('f14')
modelHandle = slreportgen.utils.getSlSfHandle('f14');
objID = slreportgen.utils.getObjectID(modelHandle)
objID =
'8bc7ba92e180202ffc5ce217625c6563'
Input Arguments
obj — Simulink or Stateflow object
object path | object handle
Simulink or Stateflow object, specified by its path or handle, for which to generate a link target ID.
8-148
slreportgen.utils.getObjectID
Output Arguments
id — Simulink or Stateflow link target ID
character vector
Simulink or Stateflow link target ID, returned as a character vector. You use this character vector as
the anchor ID for linking.
See Also
mlreportgen.dom.LinkTarget | slreportgen.report.ElementDiagram |
slreportgen.report.Diagram
Introduced in R2018b
8-149
8 Functions
slreportgen.utils.getResolvedParamValue
Package: slrportgen.utils
Syntax
param_value = slreportgen.utils.getResolvedParamValue(block,parameter)
Description
param_value = slreportgen.utils.getResolvedParamValue(block,parameter) returns
the value of a block parameter. The value of the parameter is an evaluated MATLAB expression that
includes references to workspace variables. This utility produces an
slreportgen:UnresolvableExpression error if it cannot find expression variables in the
MATLAB or model workspace.
Examples
Obtain Parameter Value
load_system('f14')
numval = slreportgen.utils.getResolvedParamValue...
('f14/Actuator Model','Numerator')
numval =
Input Arguments
block — Block name
string | character array
Block name, specified as a string or character array of the block name or block handle.
Output Arguments
param_value — Value of block parameter
depends on block
Value of block parameter. The data type of the returned value depends on the specific parameter.
8-150
slreportgen.utils.getResolvedParamValue
See Also
slreportgen.utils.traceSignal
Introduced in R2018b
8-151
8 Functions
slreportgen.utils.getSlSfHandle
Get Simulink handle or Stateflow object
Syntax
sisfhandle = slreportgen.utils.getSlSfHandle(path_id)
Description
sisfhandle = slreportgen.utils.getSlSfHandle(path_id) returns the Simulink or
Stateflow object handle of the input Simulink path, Simulink identifier (SID), or Stateflow numeric ID.
Examples
Obtain Simulink Model and Object Handles
load_system('f14')
modelHandle = slreportgen.utils.getSlSfHandle('f14')
blockHandle = slreportgen.utils.getSlSfHandle('f14/Controller')
SIDHandle = slreportgen.utils.getSlSfHandle('f14:3')
modelHandle =
2.0001
blockHandle =
38.0001
SIDHandle =
6.0001
load_system('slrgex_sf_car')
chart = find(slroot, '-isa',...
'Stateflow.Chart','Name','shift_logic');
slreportgen.utils.getSlSfHandle(chart.Id)
This example returns the list of Stateflow chart properties to the workspace. The Stateflow handle is
equivalent to the Stateflow object. To use a Stateflow handle, assign it to a variable.
Input Arguments
path_id — Simulink or Stateflow object path or ID
string | character array
Simulink or Stateflow object path or ID, specified as a string or character array. This utility returns
the handle of the specified path_id object.
8-152
slreportgen.utils.getSlSfHandle
Output Arguments
sisfhandle — Handle of object
double
See Also
getSimulinkBlockHandle | slreportgen.utils.getModelHandle
Introduced in R2018b
8-153
8 Functions
slreportgen.utils.hasDiagram
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.hasDiagram(obj)
Description
tf = slreportgen.utils.hasDiagram(obj) returns 1 (true) if the input object has a diagram
and 0 (false) if the object does not have a diagram.
You can use this function to check if an object has a diagram before you try to use the object with an
slreportgen.report.Diagram reporter.
Examples
load_system('f14');
tf = slreportgen.utils.hasDiagram('f14/Aircraft Dynamics Model')
tf =
logical
Input Arguments
obj — Object to check
string scalar | character vector | handle
Object to check for a diagram, specified as a character vector or string scalar that contains the
Simulink path of the object or as a handle to the object.
8-154
slreportgen.utils.hasDiagram
Output Arguments
tf — Whether object has a diagram
1 (true) | 0 (false)
Whether the input object has a diagram, returned as 1 (true) if the input object has a diagram or 0
(false) if the input object does not have a diagram.
See Also
slreportgen.report.Diagram | slreportgen.utils.getModelHandle
Introduced in R2020b
8-155
8 Functions
slreportgen.utils.isBusSelector
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isBusSelector(obj)
Description
tf = slreportgen.utils.isBusSelector(obj) tests if the input obj is a Simulink Bus
Selector block.
Examples
Test If Object Is a Bus Selector
load_system('sldemo_fuelsys')
slreportgen.utils.isBusSelector...
("slrgex_fuelsys_fuel_rate_control/Bus Selector1")
tf =
logical
In this case, the Bus Selector1 block in the sldemo_fuelsys model is a Bus Selector block.
Input Arguments
obj — Input object to test for being a Bus Selector block
string | character array | object handle
Input object to test for being a Bus Selector block, specified as a string or character array of the
object path or handle.
Output Arguments
tf — Whether input is a Bus Selector block
true | false
Whether input is a Bus Selector block, returned as 1 (true) if the input is a Bus Selector. Otherwise, it
returns 0 (false).
See Also
Bus Selector
8-156
slreportgen.utils.isBusSelector
Introduced in R2019a
8-157
8 Functions
slreportgen.utils.isCommented
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isCommented(obj)
Description
tf = slreportgen.utils.isCommented(obj) tests whether the input Simulink or Stateflow
object is commented out.
Examples
Check If System Is Commented Out
load_system('slrgex_sf_car')
tf = slreportgen.utils.isCommented('slrgex_sf_car/Vehicle')
tf =
logical
Input Arguments
obj — Object to check for being commented out
string | character array
Simulink or Stateflow object to check for being commented out, specified as a string or character
array of the Simulink object path or handle or Stateflow object.
Output Arguments
tf — Whether input is a masked system
true | false
Whether input is a masked system, returned as 1 (true) if the input system is masked. Otherwise, it
returns 0 (false).
See Also
Introduced in R2018b
8-158
slreportgen.utils.isDocBlock
slreportgen.utils.isDocBlock
Package: slreportgen.utils
Check if DocBlock
Syntax
tf = slreportgen.utils.isDocBlock(obj)
Description
tf = slreportgen.utils.isDocBlock(obj) tests if the input obj is a Simulink DocBlock block.
Examples
Test If Object Is a DocBlock
load_system("slrgex_fuelsys")
tf = slreportgen.utils.isDocBlock ...
("slrgex_fuelsys/To Controller/Sensor Info")
tf =
logical
In this case, the Sensor Info block in the sldemo_fuelsys model is a DocBlock.
Input Arguments
obj — Object to test for being a DocBlock
string | character array | handle
Object to test for being a DocBlock, specified as a string or character array of the block path or
handle.
Output Arguments
tf — Whether input is a DocBlock
true | false
Whether input is a DocBlock, returned as 1 (true) if the input is a DocBlock. Otherwise, it returns 0
(false).
See Also
DocBlock
8-159
8 Functions
Introduced in R2019a
8-160
slreportgen.utils.isLookupTable
slreportgen.utils.isLookupTable
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isLookupTable(obj)
Description
tf = slreportgen.utils.isLookupTable(obj) tests whether the obj is a lookup table block.
Examples
Then, loop through the results and test whether each block is a lookup table block. For each result
that is a lookup table block, create a LookupTable reporter, and add the reporter to the report.
for i=1:length(results)
block = results(i).Object;
if slreportgen.utils.isLookupTable(block)
rptr = LookupTable(block);
add(rpt,rptr);
end
end
Input Arguments
obj — Simulink block to query
string | character array
8-161
8 Functions
Simulink block to query for whether it is a lookup table block, specified as a string or character array
of its block path or handle.
Output Arguments
tf — Whether input is a lookup table block
true | false
Whether input is a lookup table block, returned as 1 (true) if the input is a lookup table block.
Otherwise, it returns 0 (false).
See Also
slreportgen.report.LookupTable | slreportgen.utils.isTruthTable
Introduced in R2018a
8-162
slreportgen.utils.isMaskedSystem
slreportgen.utils.isMaskedSystem
Package: slreportgen.utils
Syntax
tf = isMaskedSystem(system)
Description
tf = isMaskedSystem(system) tests whether the input system is masked.
Examples
Check If System Is Masked
load_system('slrgex_sf_car')
tf = slreportgen.utils.isMaskedSystem('slrgex_sf_car/Vehicle')
tf =
logical
Input Arguments
system — System to check for masking
string | character array
System to check for masking, specified as a string or character array of the Simulink path or handle.
Output Arguments
tf — Whether input is a masked system
true | false
Whether input is a masked system, returned as 1 (true) if the input system is masked. Otherwise, it
returns 0 (false).
See Also
Topics
“Create Block Masks”
8-163
8 Functions
Introduced in R2018b
8-164
slreportgen.utils.isMATLABFunction
slreportgen.utils.isMATLABFunction
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isMATLABFunction(obj)
Description
tf = slreportgen.utils.isMATLABFunction(obj) tests whether the input obj is a Simulink
MATLAB Function block or a Stateflow MATLAB function object.
Examples
Then, loop through the results and test whether each block is a MATLAB Function block. For each
result that is a MATLAB Function block, create a MATLABFunction reporter, and add the reporter to
the report.
for i=1:length(results)
block = results(i).Object;
if slreportgen.utils.isMATLABFunction(block)
rptr = MATLABFunction(block);
add(myReport,rptr);
end
end
Input Arguments
obj — Object to check for being a MATLAB Function block
string | character array
Simulink element or Stateflow object to check for being a MATLAB Function block, specified as a
string or character array of the path or handle.
Output Arguments
tf — Whether input is a MATLAB Function block or object
true | false
8-165
8 Functions
Whether input is a MATLAB Function block or object, returned as 1 (true) if the input is a MATLAB
Function or object. Otherwise, it returns 0 (false).
See Also
slreportgen.report.MATLABFunction
Introduced in R2018a
8-166
slreportgen.utils.isModel
slreportgen.utils.isModel
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isModel(obj)
Description
tf = slreportgen.utils.isModel(obj) returns 1 (true) if the input object is a Simulink model
and 0 (false) if the object is not a model.
Examples
load_system("slrgex_vdp");
tf = slreportgen.utils.isModel("slrgex_vdp")
tf =
logical
Input Arguments
obj — Object to check
handle | string scalar | character vector | handle
Object to check, specified as a handle to the object or as a character vector or string scalar that
contains the Simulink path of the object.
Output Arguments
tf — Whether object is a model
1 (true) | 0 (false)
Whether the input object is a model, returned as 1 (true) if the input object is a model or 0 (false)
if the input object is not a model.
See Also
slreportgen.utils.getModelHandle | slreportgen.utils.isModelCompiled |
slreportgen.utils.isModelLoaded
8-167
8 Functions
Introduced in R2020b
8-168
slreportgen.utils.isModelCompiled
slreportgen.utils.isModelCompiled
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isModelCompiled(model)
Description
tf = slreportgen.utils.isModelCompiled(model) tests whether the input Simulink model is
compiled.
Examples
Check If Model Is Compiled
load_system('slrgex_sf_car')
tf = slreportgen.utils.isModelCompiled('slrgex_sf_car')
tf =
logical
Input Arguments
model — Model to check for being compiled
string | character array
Model to check for being compiled, specified as a string or character array of the model path or
handle.
Output Arguments
tf — Whether model is compiled
true | false
Whether model is compiled, returned as 1 (true) if the model is compiled. Otherwise, it returns 0
(false).
See Also
slreportgen.utils.isModelLoaded | slreportgen.utils.compileModel |
slreportgen.utils.uncompileModel
8-169
8 Functions
Introduced in R2018b
8-170
slreportgen.utils.isModelLoaded
slreportgen.utils.isModelLoaded
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isModelLoaded(model)
Description
tf = slreportgen.utils.isModelLoaded(model) tests whether the input Simulink model is
loaded into memory.
Examples
Check If Model Is Loaded
load_system('slrgex_sf_car')
tf = slreportgen.utils.isModelLoaded('slrgex_sf_car')
tf =
logical
Input Arguments
model — Model to check for being loaded
string | character array
Model to check for being loaded, specified as a string or character array of the model path or handle.
Output Arguments
tf — Whether input model is loaded
true | false
Whether input model is loaded into memory, returned as 1 (true) if the input model is loaded.
Otherwise, it returns 0 (false).
See Also
slreportgen.utils.getModelHandle
Introduced in R2018b
8-171
8 Functions
slreportgen.utils.isModelReferenceBlock
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isModelReferenceBlock(obj)
Description
tf = slreportgen.utils.isModelReferenceBlock(obj) tests whether the input obj is a
Model block.
Examples
Check If Object Is a Model Block
load_system('slrgex_sf_car')
tf = slreportgen.utils.isModelReferenceBlock('slrgex_sf_car/Engine')
tf =
logical
In this case, the Engine subsystem in the slrgex_sf_car model is not a Model block.
Input Arguments
obj — Object to check for being a Model block
string | character array
Object to check for being a Model block, specified as a string or character array of the Simulink
object path or handle.
Output Arguments
tf — Whether input is a Model block
true | false
Whether input is a Model block, returned as 1 (true) if the input is a Model block. Otherwise, it
returns 0 (false).
See Also
Simulink.SubSystem.convertToModelReference
8-172
slreportgen.utils.isModelReferenceBlock
Introduced in R2018b
8-173
8 Functions
slreportgen.utils.isSID
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isSID(name)
Description
tf = slreportgen.utils.isSID(name) tests whether the input name is a syntactically correct
Simulink Identifier (SID).
Examples
Check If Input Uses Valid SID Syntax
load_system('f14')
sid_1 = slreportgen.utils.isSID('f14')
sid_2 = slreportgen.utils.isSID('f14/Controller')
sid_3 = slreportgen.utils.isSID('valid_syntax_not_valid_sid')
getsid_4 = Simulink.ID.getSID('f14/Controller');
sid_4 = slreportgen.utils.isSID(getsid_4)
sid_1 =
logical
sid_2 =
logical
sid_3 =
logical
sid_4 =
logical
8-174
slreportgen.utils.isSID
Input Arguments
name — Name to check for being an SID
string | character array
Name to check for being an SID, specified as a string or character array. This utility checks only that
the syntax of the input is valid. It does not check whether the input is a valid SID.
Output Arguments
tf — Whether input is an SID
true | false
Whether input is a syntactically correct SID, returned as 1 (true) if the input is an SID. Otherwise, it
returns 0 (false).
See Also
Introduced in R2018b
8-175
8 Functions
slreportgen.utils.isStateTransitionTableBlock
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isStateTransitionTableBlock(obj)
Description
tf = slreportgen.utils.isStateTransitionTableBlock(obj) tests whether the input obj
is a Stateflow State Transition Table block.
Examples
Check If Block Is a State Transition Table Block
load_system('slrgex_sf_car')
tf = slreportgen.utils.isStateTransitionTableBlock...
('slrgex_sf_car/shift_logic/downshifting')
tf =
logical
In this case, the downshifting object in the Stateflow shift_logic chart of the slrgex_sf_car
model is not a State Transition Table block.
Input Arguments
obj — Object to check for being a Stateflow Transition Table block
string | character array
Object to check for being a Stateflow Transition Table block, specified as a string or character array
of the object path or handle.
Output Arguments
tf — Whether input is a State Transition Table block
true | false
Whether input is a State Transition Table block, returned as 1 (true) if the input is a State Transition
Table block. Otherwise, it returns 0 (false).
8-176
slreportgen.utils.isStateTransitionTableBlock
See Also
Introduced in R2018b
8-177
8 Functions
slreportgen.utils.isTestSequence
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isTestSequence(obj)
Description
tf = slreportgen.utils.isTestSequence(obj) tests if the input obj is a Simulink Test
Sequence block or a Stateflow Test Sequence object.
Examples
Test If Object Is a Test Sequence
load_system('sltestTestSequenceDebouncerExample')
tf = slreportgen.utils.isTestSequence...
('sltestTestSequenceDebouncerExample/Debouncer_Test')
tf =
logical
Input Arguments
obj — Object to check for being a Test Sequence block or object
string | character array | handle
Object to check for being a Test Sequence block or object, specified as a string or character array of
the object path or handle.
Output Arguments
tf — Whether input is a Test Sequence block or object
true | false
Whether input is a Test Sequence block or object, returned as 1 (true) if the input is a Test Sequence.
Otherwise, it returns 0 (false).
See Also
Test Sequence
8-178
slreportgen.utils.isTestSequence
Introduced in R2019a
8-179
8 Functions
slreportgen.utils.isTruthTable
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isTruthTable(obj)
Description
tf = slreportgen.utils.isTruthTable(obj) tests if the input obj is a Simulink Truth Table
block or a Stateflow Truth Table object.
Examples
openExample('sf_climate_control');
tf = slreportgen.utils.isTruthTable...
('sf_climate_control/ClimateController')
tf =
logical
In this case, the ClimateController block in the sf_climate_control model is a Truth Table
block.
Input Arguments
obj — Object to check for being a Truth Table block or object
string | character array
Object to check for being a Truth Table block or object, specified as a string or character array of the
object path or handle.
Output Arguments
tf — Whether input is a Truth Table block or object
true | false
Whether input is a Truth Table block or object, returned as 1 (true) if the input system is a truth
table. Otherwise, it returns 0 (false).
8-180
slreportgen.utils.isTruthTable
See Also
slreportgen.report.TruthTable | slreportgen.utils.isLookupTable
Introduced in R2018b
8-181
8 Functions
slreportgen.utils.isValidSlSystem
Package: slreportgen.utils
Syntax
tf = slreportgen.utils.isValidSlSystem(system)
Description
tf = slreportgen.utils.isValidSlSystem(system) tests if the input system is a valid
Simulink block diagram or subsystem block. Use this utility to determine whether a system is in
memory.
Input Arguments
system — System to check for validity
string | character array
System to check for validity, specified as a string or character array of the path or handle of a
Simulink block diagram or subsystem block.
Output Arguments
tf — Whether system is valid
true | false
Whether system is valid, returned as 1 (true) if the input system is valid. Otherwise, it returns 0
(false).
See Also
Introduced in R2018b
8-182
slreportgen.utils.loadAllSystems
slreportgen.utils.loadAllSystems
Package: slreportgen.utils
Syntax
slreportgen.utils.loadAllSystems(name)
Description
slreportgen.utils.loadAllSystems(name) loads all systems, including masking subsystems
and libraries, into memory for the specified Simulink model name. If the input name is not a model
and is, for example, a block, this utility obtains the containing model and then, loads all of its
systems.
Input Arguments
name — Name or handle of Simulink model or Stateflow object
string | character array
Name or handle of Simulink model or Stateflow object, specified as a string or character array, for
which to load all of its systems.
See Also
slreportgen.utils.isValidSlSystem
Introduced in R2018b
8-183
8 Functions
slreportgen.utils.pathJoin
Package: slreportgen.utils
Syntax
diagrampath = slreportgen.utils.pathJoin(parent,name)
Description
diagrampath = slreportgen.utils.pathJoin(parent,name) combines the parent and
name paths to create a full Simulink diagram path. Any newlines are converted to spaces.
Examples
Combine Parent Diagram Path and Diagram Name
slreportgen.utils.pathJoin("slrgex_sf_car/transmission",...
"transmission ratio")
diagpath =
"slrgex_sf_car/transmission/transmission ratio"
Input Arguments
parent — Parent diagram path
string | character array
Output Arguments
diagrampath — Full diagram path
string
See Also
slreportgen.utils.pathSplit | slreportgen.utils.pathParts
Introduced in R2018b
8-184
slreportgen.utils.pathParts
slreportgen.utils.pathParts
Package: slreportgen.utils
Syntax
[parent,name] = slreportgen.utils.pathParts(diagramPath)
Description
[parent,name] = slreportgen.utils.pathParts(diagramPath) splits a Simulink diagram
path into its parent diagram path and its diagram name.
Examples
Split Full Diagram Path into Parent and Diagram Parts
[parent,name] = slreportgen.utils.pathParts...
('slrgex_sf_car/transmission/transmission ratio')
parent =
"slrgex_sf_car/transmission"
name =
"transmission ratio"
Input Arguments
diagramPath — Full diagram path
string | character array
Output Arguments
parent — Parent diagram path
string
See Also
slreportgen.utils.pathJoin | slreportgen.utils.pathSplit
8-185
8 Functions
Introduced in R2018b
8-186
slreportgen.utils.pathSplit
slreportgen.utils.pathSplit
Package: slreportgen.utils
Syntax
parts = slreportgen.utils.pathSplit(diagrampath)
Description
parts = slreportgen.utils.pathSplit(diagrampath) splits the input Simulink diagram path
into a string array of diagram names.
Examples
Split Diagram Path Into Separate Parts
parts = slreportgen.utils.pathSplit...
("slrgex_sf_car/transmission/transmission ratio")
parts =
Input Arguments
diagrampath — Full diagram path
string | character array
Output Arguments
parts — Diagram path parts
string array
See Also
slreportgen.utils.pathParts | slreportgen.utils.pathJoin
Introduced in R2018b
8-187
8 Functions
slreportgen.utils.traceSignal
Package: slreportgen.utils
Syntax
[blks,ports,portnums] = slreportgen.utils.traceSignal(port)
[blks,ports,portnums] = slreportgen.utils.traceSignal(portArray)
[blks,ports,portnums] = slreportgen.utils.traceSignal( ___ ,"Nonvirtual",false)
Description
[blks,ports,portnums] = slreportgen.utils.traceSignal(port) traces the signal
entering or leaving the specified port to the nonvirtual source or destination. If port is an input port,
the function returns the nonvirtual source block, port, and port number of the signal. If port is an
output port, slreportgen.utils.traceSignal returns the nonvirtual destination blocks, ports,
and port numbers of the signal. If the function is unable to trace the signal, it returns -1 as the value
of blks.
Examples
model= 'f14';
load_system(model)
srcBlock = 'f14/Aircraft Dynamics Model/Transfer Fcn.1';
ports = get_param(srcBlock, 'PortHandles');
[sb,sp,spn] = slreportgen.utils.traceSignal(ports.Inport);
fprintf('Block with input signal to trace: %s\n',srcBlock)
fprintf('Source block: %s\n',sb)
fprintf('Source port number: %d\n',spn)
bdclose(model)
8-188
slreportgen.utils.traceSignal
Model/Sum2
Source port number: 1
Input Arguments
port — Input or output port
handle
Output Arguments
blks — Blocks
-1 | character vector | N-by-1 cell array of character vectors | 1-by-M cell array
ports — Ports
handle | N-by-1 array of handles | M-by-1 cell array
• Handles
• N-by-1 array of handles for signals traced to multiple destinations.
8-189
8 Functions
• Integers
• N-by-1 cell array of integers for signals traced to multiple destinations
See Also
slreportgen.report.Signal
Introduced in R2018b
8-190
slreportgen.utils.uncompileModel
slreportgen.utils.uncompileModel
Package: slreportgen.utils
Uncompile model
Syntax
slreportgen.utils.uncompileModel(modelname)
Description
slreportgen.utils.uncompileModel(modelname) uncompiles the model specified in the
modelname input. If modelname is a Simulink block or Stateflow object, the model that contains that
block or object is uncompiled.
Input Arguments
modelname — Model to uncompile
character array | string
Model to uncompile, specified as a character array or string of the model handle, block handle, or
Stateflow objects. If modelname is an element in the model, the containing model is uncompiled.
See Also
slreportgen.utils.compileModel | slreportgen.utils.isModelCompiled
Introduced in R2018b
8-191
8 Functions
createDiagramLink
Class: slreportgen.webview.EmbeddedWebViewDocument
Package: slreportgen.webview
Syntax
diaglink = createDiagramLink(wvdoc,dhandle,domlabel)
Description
diaglink = createDiagramLink(wvdoc,dhandle,domlabel) updates a DOM object in an
embedded Web view Document panel so that it links to a diagram anchor handle in the Simulink Web
view. The diaglink DOM object is of the same type as domlabel or if domlabel is a string, an
mlreportgen.DOM.Text object is created.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
Handle of Web view diagram anchor, specified as a character vector of the path or as an object
handle. You can use the getExportDiagrams method to obtain the diagram paths and handles.
Example: Character vector: 'slrgex_vdp'. Object handle:
get_param('slrgex_vdp','handle')
DOM object from which to link, specified as a valid DOM object or as a character vector. If you enter
a character vector, an mlreportgen.DOM.Text object is created.
Output Arguments
diaglink — Diagram link
DOM object
Diagram link to the specified Simulink Web view diagram, returned as a DOM object. The DOM object
has an attribute that marks it as a link.
Examples
8-192
createDiagramLink
Use createDiagramLink to create links from level-two headings in the document pane to the
associated diagrams in the embedded web view. This example also uses createElementLink to
create links from block names in the document pane to blocks in the embedded web view.
methods
function wvdoc = ExampleWebView(reportPath,modelName)
% Invoke the EmbeddedWebViewDocument constructor, which
% saves the report path and model name for use by the
% report's fill methods.
[email protected](reportPath,modelName);
end
function fillContent(wvdoc)
% Fill the Content hole in the report template with design
% variable information. You can use DOM or Report API methods
% to create, format, add, and append content to this report.
n = numel(handles);
for i = 1:n
diagHandle = handles{i};
diagHeading = createDiagramLink(wvdoc,diagHandle, ...
mlreportgen.dom.Heading(2,get_param(diagHandle,'Name')));
append(wvdoc,diagHeading);
blockFinder = slreportgen.finder.BlockFinder(diagHandle);
while hasNext(blockFinder)
r = next(blockFinder);
elemHandle = r.Object;
elemHeading = createElementLink(wvdoc,elemHandle, ...
mlreportgen.dom.Heading(3,get_param(elemHandle,'Name')));
append(wvdoc,elemHeading);
end
end
end
end
end
Create an object of the ExampleWebView class and use its methods to generate the embedded web
view report.
model = 'slrgex_vdp';
open_system(model);
wvdoc = ExampleWebView('myReport',model);
open(wvdoc);
fill(wvdoc);
8-193
8 Functions
close(wvdoc);
rptview(wvdoc);
More About
Diagram
Element
Element refers to an individual item within a diagram, such as a block, annotation, state, or
transition.
See Also
slreportgen.webview.WebViewDocument |
slreportgen.webview.EmbeddedWebViewDocument | createElementLink |
createElementTwoWayLink | createDiagramTwoWayLink | getExportDiagrams
Topics
“Create Hyperlinks for Embedded Web View Report” on page 5-29
“Embedded Web View Reports” on page 5-20
“Create an Embedded Web View Report Generator” on page 5-24
Introduced in R2017a
8-194
createDiagramTwoWayLink
createDiagramTwoWayLink
Class: slreportgen.webview.EmbeddedWebViewDocument
Package: slreportgen.webview
Syntax
diag2link = createDiagramTwoWayLink(wvdoc,dhandle,domlabel)
Description
diag2link = createDiagramTwoWayLink(wvdoc,dhandle,domlabel) creates a two-way
connection between a Simulink Web view diagram and a DOM object in an embedded Web view
Document panel. The diag2link DOM object is updated to include attributes that identifies it as a
link. The diag2link DOM object is of the same type as domlabel or if domlabel is a string, an
mlreportgen.DOM.Text object is created.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
Handle of Web view diagram anchor, specified as a character vector of the path or as an object
handle. You can use the getExportDiagrams method to obtain the diagram paths and handles.
Example: Character vector: 'slrgex_vdp'. Object handle:
get_param('slrgex_vdp','handle')
DOM object from which to link, specified as a valid DOM object or as a character vector. If you enter
a character vector, an mlreportgen.DOM.Text object is created.
Output Arguments
diag2link — Diagram link and Web view anchor
DOM object
Diagram link and Web view anchor, returned as a DOM object. The diag2link object connects a
DOM object in the embedded Web view Document panel to the specified Simulink web view diagram.
The DOM object is updated with an attribute that indicates it is a link to the anchor.
8-195
8 Functions
Examples
methods
function wvdoc = ExampleWebView(reportPath,modelName)
% Invoke the EmbeddedWebViewDocument constructor, which
% saves the report path and model name for use by the
% report's fill methods.
[email protected](reportPath,modelName);
end
function fillContent(wvdoc)
% Fill the Content hole in the report template with design
% variable information. You can use DOM or Report API methods
% to create, format, add, and append content to this report.
n = numel(handles);
for i = 1:n
diagHandle = handles{i};
diagHeading = createDiagramTwoWayLink(wvdoc,diagHandle, ...
mlreportgen.dom.Heading(2,get_param(diagHandle,'Name')));
append(wvdoc,diagHeading);
blockFinder = slreportgen.finder.BlockFinder(diagHandle);
while hasNext(blockFinder)
r = next(blockFinder);
elemHandle = r.Object;
elemHeading = createElementTwoWayLink(wvdoc,elemHandle, ...
mlreportgen.dom.Heading(3,get_param(elemHandle,'Name')));
append(wvdoc,elemHeading);
end
end
end
end
end
Create an object of the ExampleWebView class and use its methods to generate the embedded web
view report.
8-196
createDiagramTwoWayLink
model = 'slrgex_vdp';
open_system(model);
wvdoc = ExampleWebView('myReport',model);
open(wvdoc);
fill(wvdoc);
close(wvdoc);
rptview(wvdoc);
More About
Diagram
Element
Element refers to an individual item within a diagram, such as a block, annotation, state, or
transition.
See Also
slreportgen.webview.WebViewDocument |
slreportgen.webview.EmbeddedWebViewDocument | createElementTwoWayLink |
createDiagramLink | createElementLink | getExportDiagrams
Topics
“Create Hyperlinks for Embedded Web View Report” on page 5-29
“Embedded Web View Reports” on page 5-20
“Create an Embedded Web View Report Generator” on page 5-24
Introduced in R2017a
8-197
8 Functions
createElementLink
Class: slreportgen.webview.EmbeddedWebViewDocument
Package: slreportgen.webview
Syntax
elemLink = createElementLink(wvdoc,ehandle,domlabel)
Description
elemLink = createElementLink(wvdoc,ehandle,domlabel) updates a DOM object in an
embedded Web view Document panel so that it links to an element anchor in the Simulink Web view.
The DOM object is of the same type as domlabel or, if domlabel is a string, an
mlreportgen.DOM.Text object is created.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
Handle of Web view element anchor, specified as a character vector of the path or as an object
handle. You can use the getExportDiagrams method to obtain the element paths and handles.
Example: Character vector: 'slrgex_vdp/Mu'. Object handle: get_param('slrgex_vdp/
Mu','handle')
DOM object from which to link, specified as a valid DOM object or as a character vector. If you enter
a character vector, an mlreportgen.DOM.Text object is created.
Output Arguments
elemLink — Element link
array of character vectors
Element link to the specified Simulink Web view element, returned as a DOM object. The DOM object
has an attribute that marks it as a link.
Examples
8-198
createElementLink
Use CreateElementLink to create links from block names in the document pane to blocks in the
diagram in the embedded web view. This example also uses createDiagramLink to create links
from level two headings in the document pane to diagrams in the embedded web view.
methods
function wvdoc = ExampleWebView(reportPath,modelName)
% Invoke the EmbeddedWebViewDocument constructor, which
% saves the report path and model name for use by the
% report's fill methods.
[email protected](reportPath,modelName);
end
function fillContent(wvdoc)
% Fill the Content hole in the report template with design
% variable information. You can use DOM or Report API methods
% to create, format, add, and append content to this report.
n = numel(handles);
for i = 1:n
diagHandle = handles{i};
diagHeading = createDiagramLink(wvdoc,diagHandle, ...
mlreportgen.dom.Heading(2,get_param(diagHandle,'Name')));
append(wvdoc,diagHeading);
blockFinder = slreportgen.finder.BlockFinder(diagHandle);
while hasNext(blockFinder)
r = next(blockFinder);
elemHandle = r.Object;
elemHeading = createElementLink(wvdoc,elemHandle, ...
mlreportgen.dom.Heading(3,get_param(elemHandle,'Name')));
append(wvdoc,elemHeading);
end
end
end
end
end
Create an object of the ExampleWebView class and use its methods to generate the embedded web
view report.
model = 'slrgex_vdp';
open_system(model);
wvdoc = ExampleWebView('myReport',model);
open(wvdoc);
fill(wvdoc);
8-199
8 Functions
close(wvdoc);
rptview(wvdoc);
More About
Diagram
Element
Element refers to an individual item within a diagram, such as a block, annotation, state, or
transition.
See Also
slreportgen.webview.WebViewDocument |
slreportgen.webview.EmbeddedWebViewDocument | createElementTwoWayLink |
createDiagramLink | createDiagramTwoWayLink | getExportDiagrams
Topics
“Create Hyperlinks for Embedded Web View Report” on page 5-29
“Embedded Web View Reports” on page 5-20
“Create an Embedded Web View Report Generator” on page 5-24
Introduced in R2017a
8-200
createElementTwoWayLink
createElementTwoWayLink
Class: slreportgen.webview.EmbeddedWebViewDocument
Package: slreportgen.webview
Syntax
elem2link = createElementTwoWayLink(wvdoc,ehandle,domlabel)
Description
elem2link = createElementTwoWayLink(wvdoc,ehandle,domlabel) creates a two-way
connection between a Simulink Web view element and a DOM object in an embedded Web view
Document panel. The elem2link DOM object is updated to include attributes that identifies it as a
link. The elem2link DOM object is of the same type as domlabel or if domlabel is a string, an
mlreportgen.DOM.Text object is created.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
Handle of Web view element anchor, specified as a character vector of the path or as an object
handle. You can use the getExportDiagrams method to obtain the element paths and handles.
Example: Character vector: 'slrgex_vdp/Mu'. Object handle: get_param('slrgex_vdp/
Mu','handle')
DOM object from which to link, specified as a valid DOM object or as a character vector. If you enter
a character vector, an mlreportgen.DOM.Text object is created.
Output Arguments
elem2link — Element link and Web view anchor
DOM object
Element link and Web view anchor, returned as a DOM object. The elem2link object connects a
DOM object in the embedded Web view Document panel to the specified Simulink Web view element.
The DOM object is updated with an attribute that indicates it is a link to the anchor.
8-201
8 Functions
Examples
Use CreateElementTwoWayLink to create two-way links between block names in the document
pane and blocks in the diagram in the embedded web view. This example also uses
createDiagramTwoWayLink to create links between level two headings in the document pane and
diagrams in the embedded web view.
methods
function wvdoc = ExampleWebView(reportPath,modelName)
% Invoke the EmbeddedWebViewDocument constructor, which
% saves the report path and model name for use by the
% report's fill methods.
[email protected](reportPath,modelName);
end
function fillContent(wvdoc)
% Fill the Content hole in the report template with design
% variable information. You can use DOM or Report API methods
% to create, format, add, and append content to this report.
n = numel(handles);
for i = 1:n
diagHandle = handles{i};
diagHeading = createDiagramTwoWayLink(wvdoc,diagHandle, ...
mlreportgen.dom.Heading(2,get_param(diagHandle,'Name')));
append(wvdoc,diagHeading);
blockFinder = slreportgen.finder.BlockFinder(diagHandle);
while hasNext(blockFinder)
r = next(blockFinder);
elemHandle = r.Object;
elemHeading = createElementTwoWayLink(wvdoc,elemHandle, ...
mlreportgen.dom.Heading(3,get_param(elemHandle,'Name')));
append(wvdoc,elemHeading);
end
end
end
end
end
Create an object of the ExampleWebView class and use its methods to generate the embedded web
view report.
8-202
createElementTwoWayLink
model = 'slrgex_vdp';
open_system(model);
wvdoc = ExampleWebView('myReport',model);
open(wvdoc);
fill(wvdoc);
close(wvdoc);
rptview(wvdoc);
More About
Diagram
Element
Element refers to an individual item within a diagram, such as a block, annotation, state, or
transition.
See Also
slreportgen.webview.WebViewDocument |
slreportgen.webview.EmbeddedWebViewDocument | createDiagramLink |
createDiagramTwoWayLink | createElementLink | getExportDiagrams
Topics
“Create Hyperlinks for Embedded Web View Report” on page 5-29
“Embedded Web View Reports” on page 5-20
“Create an Embedded Web View Report Generator” on page 5-24
Introduced in R2017a
8-203
8 Functions
getReportObject
Class: slreportgen.webview.EmbeddedWebViewDocument
Package: slreportgen.webview
Syntax
rptobj = getReportObject(rpt)
Description
rptobj = getReportObject(rpt) returns the slreportgen.report.Report object associated
with an embedded web view report. You can use the report object to get the DOM object that
implements a reporter in your report. Examining the DOM implementation can help you to debug
report generation issues.
Input Arguments
rpt — Embedded web view report
object of subclass of slreportgen.webview.EmbeddedWebViewDocument
Output Arguments
rptobj — Report object
slreportgen.report.Report
Examples
Get the report object for an embedded web view report by calling the getReportObject method.
Then, get the DOM object that implements the title page reporter in the report.
Create the embedded web view class used in “Generate an Embedded Web View Report” on page 5-
35.
methods
function rpt = SystemDesignVariables(reportPath, modelName)
[email protected](reportPath,...
8-204
getReportObject
modelName);
rpt.ValidateLinksAndAnchors = false;
rpt.ExportOptions.IncludeMaskedSubsystems = true;
rpt.ExportOptions.IncludeSimulinkLibraryLinks = true;
rpt.ExportOptions.IncludeReferencedModels = true;
end
function fillContent(rpt)
import mlreportgen.dom.*
import mlreportgen.report.*
model = getExportModels(rpt);
model= model{1};
tp = TitlePage("Title",[model " Report"],"Author","");
add(rpt,tp);
finder = slreportgen.finder.ModelVariableFinder(model);
ch = Chapter("Variables");
while hasNext(finder)
result = next(finder);
s = Section(result.Name);
reporter = getReporter(result);
add(s,reporter);
add(ch,s);
end
add(rpt,ch);
end
end
end
add(rpt,tp);
model = 'f14';
rptName = sprintf('%sVariables', model);
load_system(model);
rpt = SystemDesignVariables(rptName, model);
fill(rpt);
close(rpt);
close_system(model);
rptview(rptName);
rptObj = getReportObject(rpt);
impl = getImpl(tp,rptObj)
8-205
8 Functions
To clear the breakpoint, right-click the breakpoint icon and select Clear Breakpoint from the
context menu.
See Also
slreportgen.report.Report
Topics
“Generate an Embedded Web View Report” on page 5-35
“Debug MATLAB Code Files”
Introduced in R2019b
8-206
fill
fill
Class: slreportgen.webview.WebViewDocument
Package: slreportgen.webview
Syntax
fill(wvdoc)
Description
fill(wvdoc) fills the holes in the report generated by wvdoc. This method loops through the holes
in the report’s template. For each hole, it determines if this object has a method named
fillId(wvdoc), where Id is the id of the hole. If the method exists, this method invokes the method
to fill the hole.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
Tips
• The default template specified by wvdoc contains a hole named slwebview. Thus invoking this
method will invoke slreportgen.webview.WebViewDocument.fillslwebview to fill the hole
with web views of the model(s) specified by wvdoc’s ExportOptions property.
• This method allows you to fill holes in a custom template by deriving a class from
slreportgen.webview.WebViewDocument and providing the derived class with fillId
methods to fill the holes.
8-207
8 Functions
append
Class: slreportgen.webview.WebViewDocument
Package: slreportgen.webview
Syntax
append(wvdoc,content)
Description
append(wvdoc,content) appends content to the web view document. You can append any type of
content that can be appended to an mlreportgen.dom.Document object.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
The value of this object can be any type of MATLAB or DOM API object that can be appended to a
DOM document.
Tips
• Use this method to fill holes in a custom template that you create to be used with
slreportgen.webview.WebViewDocument or
slreportgen.webview.EmbeddedWebViewDocument objects.
• To fill the Content hole defined by the default template specified by a class that you derive from
slreportgen.webview.EmbeddedWebViewDocument class, define a fillContent method in
your derived class and use this method in the fillContent method to fill the hole with document
content. See fillfor more information.
8-208
fillslwebview
fillslwebview
Class: slreportgen.webview.WebViewDocument
Package: slreportgen.webview
Syntax
fillslwebview(wvdocgen)
Description
fillslwebview(wvdocgen) creates the web view specified by the ExportOptions property of the
specified web view document generator (i.e., wvdocgen) and inserts the web view in the generator’s
output document at the location specified by an slwebview hole in the generator’s document
template.
Input Arguments
wvdocgen — Web view document
slreportgen.webview.WebViewDocument object
See Also
fill
Introduced in R2017a
8-209
8 Functions
getExportDiagrams
Class: slreportgen.webview.WebViewDocument
Package: slreportgen.webview
Syntax
[paths,handles] = getExportDiagrams(wvdoc)
Description
[paths,handles] = getExportDiagrams(wvdoc) returns an array of diagram paths and
handles to export.
Examples
Get the paths and handles for a Web view of the f14 Simulink model and subsystems.
f14
wvdoc = slreportgen.webview.WebViewDocument('myWebview','f14');
[paths,handles] = getExportDiagrams(wvdoc)
paths =
'f14'
'f14/Aircraft Dynamics Model'
'f14/Controller'
'f14/Dryden Wind Gust Models'
'f14/Nz pilot calculation'
handles =
[ 2.0001]
[ 7.0001]
[39.0001]
[69.0004]
[84.0001]
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
8-210
getExportDiagrams
Output Arguments
paths — Diagram paths
cell array of character vectors
Diagram paths in the model, including the model name and its subsystem names, returned as a cell
array of character vectors.
Diagram handles that correspond to the diagram paths. returned as an array of character vectors.
More About
Diagram
Element
Element refers to an individual item within a diagram, such as a block, annotation, state, or
transition.
See Also
getExportModels | getExportSimulinkSubSystems | getExportStateflowCharts |
getExportStateflowDiagrams
Introduced in R2017a
8-211
8 Functions
getExportModels
Class: slreportgen.webview.WebViewDocument
Package: slreportgen.webview
Syntax
[paths,handles] = getExportModels(wvdoc)
Description
[paths,handles] = getExportModels(wvdoc) returns an array of model paths and handles to
export.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
Output Arguments
paths — Model paths
array of character vectors
Diagram handles that correspond to the diagram paths. returned as an array of character vectors.
Examples
Get the path and handle for a Web view of the f14 Simulink model.
f14
wvdoc = slreportgen.webview.WebViewDocument('myWebview','f14');
[path,handle] = getExportModels(wvdoc)
path =
cell
'f14'
8-212
getExportModels
handle =
100.0002
See Also
getExportDiagrams | getExportSimulinkSubSystems | getExportStateflowCharts |
getExportStateflowDiagrams
Introduced in R2017a
8-213
8 Functions
getExportSimulinkSubSystems
Class: slreportgen.webview.WebViewDocument
Package: slreportgen.webview
Syntax
[paths,handles] = getExportDiagrams(wvdoc)
Description
[paths,handles] = getExportDiagrams(wvdoc) returns a cell array of subsystem paths and
handles to export.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
Output Arguments
paths — Subsystem paths
cell array of character vectors
Subsystem handles that correspond to the Subsystem paths, returned as an array of character
vectors.
Examples
Get the paths and handles for a Web view of the f14 Simulink subsystems.
f14
wvdoc = slreportgen.webview.WebViewDocument('myWebview','f14');
[paths,handles] = getExportSimulinkSubSystems(wvdoc)
paths =
8-214
getExportSimulinkSubSystems
handles =
105.0001
137.0001
167.0004
182.0001
More About
Diagram
Element
Element refers to an individual item within a diagram, such as a block, annotation, state, or
transition.
See Also
getExportModels | getExportDiagrams | getExportStateflowCharts |
getExportStateflowDiagrams
Introduced in R2017a
8-215
8 Functions
getExportStateflowCharts
Class: slreportgen.webview.WebViewDocument
Package: slreportgen.webview
Syntax
[paths,handles] = getExportStateflowCharts(wvdoc)
Description
[paths,handles] = getExportStateflowCharts(wvdoc) returns an array of the Stateflow
chart paths and handles at the top level of the model to export.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
Output Arguments
paths — Stateflow chart paths
cell array of character vectors
Stateflow chart paths in the model, returned as a cell array of character vectors.
Stateflow chart handles that correspond to the paths. returned as an array of character vectors.
Examples
Get the paths and handles for Stateflow charts in the sf_cdplayer Simulink model.
openExample('sf_cdplayer');
wvdoc = slreportgen.webview.WebViewDocument('myWebview','sf_cdplayer');
[paths,handles] = getExportStateflowCharts(wvdoc)
paths =
8-216
getExportStateflowCharts
handles =
Stateflow.Chart: 1-by-3
See Also
getExportModels | getExportDiagrams | getExportSimulinkSubSystems |
getExportStateflowDiagrams
Introduced in R2017a
8-217
8 Functions
getExportStateflowDiagrams
Class: slreportgen.webview.WebViewDocument
Package: slreportgen.webview
Syntax
[paths,handles] = getExportStateflowDiagrams(wvdoc)
Description
[paths,handles] = getExportStateflowDiagrams(wvdoc) returns an array of Stateflow
chart paths and handles to export. The paths and handles are returned for both charts at the top level
of the model and all charts in the hierarchy.
Input Arguments
wvdoc — Web view document
slreportgen.webview.WebViewDocument object
Output Arguments
paths — Stateflow diagram paths
cell array of character vectors
Stateflow diagram paths in the model, returned as a cell array of character vectors.
Stateflow diagram handles that correspond to the Stateflow diagram paths. returned as an array of
character vectors.
Examples
Get the paths and handles for Stateflow diagrams in the sf_cdplayer Simulink model.
openExample('sf_cdplayer');
wvdoc = slreportgen.webview.WebViewDocument('myWebview','sf_cdplayer');
[paths,handles] = getExportStateflowDiagrams(wvdoc)
paths =
8-218
getExportStateflowDiagrams
handles =
Stateflow.Object: 1-by-7
See Also
getExportModels | getExportDiagrams | getExportSimulinkSubSystems
Introduced in R2017a
8-219
8 Functions
slwebview
Export Simulink models to web views
Syntax
slwebview
filename = slwebview(system_name)
filename = slwebview(folder)
filename = slwebview(system_name,Name,Value)
Description
slwebview starts the web view dialog box in the Report Explorer.
Examples
open_system("slrgex_fuelsys")
Export the Engine Gas Dynamics subsystem and the system that contains it to a web view. Do not
export the subsystems that it contains.
fuelsys_web_view1 = slwebview(...
"slrgex_fuelsys/Engine Gas Dynamics","SearchScope","CurrentAndAbove")
Navigate to the Engine_Gas_Dynamics folder and open webview.html in a web browser. See
“Display and Navigate a Web View” on page 5-5. Here is the web view:
8-220
slwebview
open_system("slrgex_fuelsys")
Export the model to a web view and allow access to the models it references.
fuelsys_web_view2 = slwebview(...
"slrgex_fuelsys","FollowModelReference","on")
Navigate to the slrgex_fuelsys folder and open webview.html in a web browser. See “Display
and Navigate a Web View” on page 5-5. Here is the web view:
8-221
8 Functions
Click the fuel_rate_control block to see its properties. Double-click the fuel_rate_control block to
display the referenced model.
Input Arguments
system_name — System to export to a web view file
string containing the path to the system | handle to a subsystem or block diagram | handle to a chart
or subchart
Exports the specified system or subsystem and its child systems to a web view file. By default, child
systems of the system_name system are also exported. Use the SearchScope name-value pair to
export other systems, in relation to system_name.
Path to the file folder containing one or more models to export to a web view file, specified as a
string. All models in the folder are exported.
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.
Example: htmlFileName = slwebview(gcs,'LookUnderMasks','all',...
'FollowLinks','on') Export to a web view all layers of the model hierarchy to which the current
system belongs, including the ability to interact with library links and masks.
'CurrentAndBelow' exports the Simulink system or the Stateflow chart specified by system_name
and all systems or charts that it contains.
'Current' exports only the Simulink system or the Stateflow chart specified by system_name.
'CurrentAndAbove' exports the Simulink system or the Stateflow chart specified by the
system_name and all systems or charts that contain it.
'All' exports all Simulink systems or Stateflow charts in the model that contains the system or chart
specified by system_name.
Data Types: char
'none' does not export masked blocks in the web view. Masked blocks are included in the exported
systems, but you cannot access the contents of the masked blocks.
8-222
slwebview
'off' does not allow you to follow links into library blocks in a web view.
'on' allows you to follow links into library blocks in a web view.
Data Types: char
'off' does not allow you to access referenced models in a web view.
Whether to export models in subfolders to a web View file, specified as a logical. If false, the web
view includes models only in the top-level folder and does not include models in subfolders. If true,
models in subfolders are also included. This property applies only if you specify a folder as an input
argument.
Name of the web view output package, specified as a character vector. The web view output is a .zip
file or folder of unzipped web view files, or both types of outputs.
Data Types: char
PackageFolder — Path of folder in which to place the packaged web view output
current working directory (default)
Path in which to place the packaged web view, specified as a character vector. To save the packaged
web view in the same folder as the model, use $model as the PackageFolder.
Data Types: char
Type of web view output package, specified as a zipped file, a folder of unzipped files, or both a
zipped file and folder of unzipped files.
Data Types: char
Optional views to include, specified as a cell array that contains one or both of these values:
• 'requirements'
• 'coverage'
8-223
8 Functions
See “Include Model Requirements and Coverage Data in a Web View” on page 5-18.
ViewFile — Whether to display the web view in a web browser when you export the web
view
true (default) | false
true displays the web view in a web browser when you export the web view.
false does not display the web view in a web browser when you export the web view.
Data Types: logical
ShowProgressBar — Whether to display the status bar when you export a web view
true (default) | false
true displays the status bar when you export a web view.
false does not display the status bar when you export a web view.
Data Types: logical
Output Arguments
filename — The name of the HTML file for displaying the web view
string
Reports the name of the HTML file for displaying the web view. Exporting a web view creates the
supporting files, in a folder.
Tips
A web view is an interactive rendition of a model that you can view in a web browser. You can
navigate a web view hierarchically to examine specific subsystems and to see properties of blocks and
signals.
You can use web views to share models with people who do not have Simulink installed.
Web views require a web browser that supports Scalable Vector Graphics (SVG).
See Also
Topics
“Create and Use a Web View of a Model” on page 5-12
“Display and Navigate a Web View” on page 5-5
Introduced in R2006a
8-224