Print Preview C:\TEMP\Apdf_2541_3068\home\AppData\Local\PTC\Arbortext\Editor\.aptcache\ae2n4tr7/tf2n4uhl Simulink Report Generator User's Guide

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 430 [warning: Documents this large are best viewed by clicking the View PDF Link!]

Simulink®Report Generator™
User’s Guide
R2012b
How to Contact MathWorks
www.mathworks.com Web
comp.soft-sys.matlab Newsgroup
www.mathworks.com/contact_TS.html Technical Support
suggest@mathworks.com Product enhancement suggestions
bugs@mathworks.com Bug reports
doc@mathworks.com Documentation error reports
service@mathworks.com Order status, license renewals, passcodes
info@mathworks.com Sales, pricing, and general information
508-647-7000 (Phone)
508-647-7001 (Fax)
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site.
Simulink®Report Generator™ User’s Guide
© COPYRIGHT 1999–2012 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern
theuse,modification,reproduction,release,performance,display,anddisclosureoftheProgramand
Documentation by the federal government (or other entity acquiring for or through the federal government)
and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the
government’s needs or is inconsistent in any respect with federal procurement law, the government agrees
to return the Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
January 1999 First printing New (Release 11)
December 2000 Second printing Revised (Release 12)
June 2004 Third printing Revised for Version 2.02 (Release 14)
August 2004 Online only Revised for Version 2.1
October 2004 Online only Revised for Version 2.1.1 (Release 14SP1)
December 2004 Online only Revised for Version 2.2 (Release 14SP1+)
April 2005 Online only Revised for Version 2.2.1 (Release 14SP2+)
September 2005 Online only Revised for Version 2.3.1 (Release 14SP3)
March 2006 Online only Revised for Version 3.0 (Release 2006a)
September 2006 Online only Revised for Version 3.1 (Release 2006b)
March 2007 Fourth printing Revised for Version 3.2 (Release 2007a)
September 2007 Fifth printing Revised for Version 3.2.1 (Release 2007b) This
publication was previously for MATLAB®and
Simulink®.ItisnowforSimulink
®only.
March 2008 Online only Revised for Version 3.3 (Release 2008a)
October 2008 Online only Revised for Version 3.4 (Release 2008b)
October 2008 Online only Revised for Version 3.5 (Release 2008b+)
March 2009 Online only Revised for Version 3.6 (Release 2009a)
September 2009 Online only Revised for Version 3.7 (Release 2009b)
March 2010 Online only Revised for Version 3.8 (Release 2010a)
September 2010 Online only Revised for Version 3.9 (Release 2010b)
April 2011 Online only Revised for Version 3.10 (Release 2011a)
September 2011 Online only Revised for Version 3.11 (Release 2011b)
March 2012 Online only Revised for Version 3.12 (Release 2012a)
September 2012 Online only Revised for Version 3.13 (Release 2012b)
Contents
User’s Guide
Getting Started
1
Product Description ............................... 1-2
Key Features ..................................... 1-2
System Design Documentation and Results
Reporting ....................................... 1-3
Types of Reports .................................. 1-3
System Design Documentation ...................... 1-3
Results Reporting ................................. 1-4
Interactive Model Exploration ...................... 1-6
Simulink Report Generator Tools .................... 1-6
Simulink Model Exploration Tools .................... 1-7
Report Creation Workflow ......................... 1-9
Report Components ................................ 1-10
About Report Components .......................... 1-10
Report Structure Components ....................... 1-11
System-Based Components ......................... 1-11
User-Supplied Information Components ............... 1-13
Dynamic Reporting Components ..................... 1-14
Format Control at the Component Level ............... 1-14
Report Explorer ................................... 1-15
About the Report Explorer .......................... 1-15
v
How Simulink Report Generator and Simulink
Software Interact ................................ 1-18
Supported Report Formats ......................... 1-20
Browser Requirements for Web Views ............... 1-21
Examples
Creating Reports .................................. 2
Generating Reports from MATLAB Files ............. 3
Creating Web Views ............................... 4
Working with Components ......................... 5
Generate System Design Description Reports
2
System Design Description ......................... 2-2
Predefined Standard Reports ........................ 2-2
What Is the System Design Description? ............... 2-3
What You Can Do with the Report ................... 2-3
Report Contents .................................. 2-3
Generate a System Design Description .............. 2-7
Open the System Design Description Dialog Box ........ 2-7
Choose System Design Description Options ............ 2-7
Customize the System Design Description ........... 2-10
Using the Report Explorer to Customize the Report ..... 2-10
Building a Dialog Box for a Custom Report Setup File ... 2-11
vi Contents
Creating Simulink Reports
3
Create a Simulink Report Generator Report ......... 3-2
Report Options .................................... 3-3
Add Components to the Report Setup File ........... 3-5
Report Components ................................ 3-5
Add MATLAB Code ................................ 3-7
Add a Title Page .................................. 3-13
Open the Simulink Model ........................... 3-15
Add Logical Then and Logical Else Components ........ 3-18
Error If Model Cannot Be Opened .................... 3-19
Create the Body of the Report ....................... 3-22
Process with a Model Loop Component ................ 3-23
Add a Paragraph for Each Model ..................... 3-25
Insert a Snapshot of the Model ...................... 3-27
Add a Loop for Processing the Model .................. 3-28
Block Parameter Value from a MATLAB Expression ..... 3-30
Create a Section for Each Iteration ................... 3-32
Insert the Block Value ............................. 3-33
Set a Parameter Value ............................. 3-34
Check Value Using a Logical If Component ............ 3-36
Simulate the Model Using a Model Simulation
Component .................................... 3-39
Create a Post-Test Analysis Section .................. 3-45
Error Handling for MATLAB Code .................. 3-53
Generate the Report ............................... 3-55
Generate a Report
4
Generate a Report ................................. 4-2
Run a Report ..................................... 4-2
Report Output Options ............................. 4-2
vii
SetReportOutputOptions ......................... 4-4
Report Output Format and Stylesheet ................ 4-4
PDF Stylesheets .................................. 4-7
Web Stylesheets .................................. 4-8
RTF (DSSSL Print) and Word Stylesheets ............. 4-9
Report Generation Processing ....................... 4-9
Output File Location ............................... 4-12
Regenerate Images ................................ 4-13
Add Description of Report Setup ..................... 4-14
Change Report Locale ............................. 4-15
Convert XML Documents ........................... 4-16
Why Convert XML Documents? ...................... 4-16
Convert XML Documents Using the Report Explorer .... 4-16
Convert XML Documents Using the Command Line ..... 4-18
Edit XML Source Files ............................. 4-18
Create a Log File .................................. 4-19
Generate MATLAB Code from Report Setup File ..... 4-20
Legacy Report Setup Files .......................... 4-23
What Are Legacy Report Setup Files? ................. 4-23
Enable Legacy Interface ............................ 4-23
Use Legacy Interface ............................... 4-24
Troubleshooting Report Generation Issues .......... 4-25
Memory Usage .................................... 4-25
HTML Report Display on UNIX Systems .............. 4-25
Export Simulink Models to Web Views
5
Web Views ........................................ 5-2
Export Models to the Web .......................... 5-3
viii Contents
Open the Export Interface .......................... 5-3
SetExportOptions ................................ 5-3
Generate and Review Web Views ..................... 5-5
Navigate Web Views ............................... 5-7
Display Web Views ................................ 5-7
View the Current Layer ............................ 5-7
View Layers Below the Top Layer .................... 5-8
View All Layers ................................... 5-9
Create Web Views of Simulink Models ............... 5-11
About This Tutorial ................................ 5-11
Specify Web View Export Options .................... 5-11
Export Models .................................... 5-13
Navigate Web Views ............................... 5-14
Troubleshooting Web Views ........................ 5-21
Web View Display Issues ........................... 5-21
Add Content with Components
6
Components ....................................... 6-2
Control Format with Stylesheets ..................... 6-3
Control Format at the Component Level ............... 6-3
Report Structure Components ...................... 6-4
Table Formatting Components ...................... 6-5
Property Table Components ........................ 6-6
About Property Table Components ................... 6-6
Open the Example Report Template .................. 6-8
Examine the Property Table Output .................. 6-8
Select Object Types ................................ 6-9
Display Property Name/Property Value Pairs .......... 6-9
Edit Table Titles .................................. 6-12
EnterTextintoTableCells ......................... 6-12
ix
Add, Replace, and Delete Properties in Tables .......... 6-13
Format Table Columns, Rows, and Cells ............... 6-14
Zoom and Scroll ................................... 6-16
Select a Table .................................... 6-16
Summary Table Components ....................... 6-17
About Summary Table Components .................. 6-17
Open the Example Report Template .................. 6-19
Select Object Types ................................ 6-19
Add and Remove Properties ......................... 6-19
Set Relative Column Widths ........................ 6-20
SetObjectRowOptions ............................ 6-20
Dynamic Reporting Components .................... 6-22
Logical and Looping Components .................... 6-22
Edit Figure Loop Components ....................... 6-22
Compare Simulink Model XML Files
7
Compare Simulink Model XML Files ................. 7-2
Introduction ...................................... 7-2
Overview of XML Comparison ....................... 7-3
Select Files to Compare ............................ 7-5
Choose a Comparison Type .......................... 7-7
Compare XML Files from Models with Identical Names .. 7-7
Examples of XML Comparison ....................... 7-8
Explore the XML Comparison Report for Simulink
Models ......................................... 7-10
Navigate the Simulink XML Comparison Report ........ 7-10
Display Items in Original Models .................... 7-14
Filter Out Differences .............................. 7-17
Merge Simulink Models From the Comparison Report ... 7-18
Understand the Report ............................. 7-20
Work with Referenced Models and Library Links ....... 7-22
Export, Print, and Save XML Comparison Results .... 7-24
Export Printable Report ............................ 7-24
xContents
Export Results to the Workspace ..................... 7-24
Save Comparison Log Files in a Zip File ............... 7-26
Compare XML from Models Managed with
Subversion ...................................... 7-27
Work with Subversion .............................. 7-27
Create file_comparison_driver Function ............... 7-28
Configure TortoiseSVN ............................. 7-28
Test TortoiseSVN Setup ............................ 7-30
Example file_comparison_driver Code ................. 7-31
Component Reference
8
Simulink Coder Components ....................... 8-2
Requirements Management Interface Components ... 8-3
Simulink Components .............................. 8-4
Simulink Blocks Components ....................... 8-7
Simulink Fixed Point Components .................. 8-8
Stateflow Components ............................. 8-9
xi
Components — Alphabetical List
9
Function Reference
10
GUI .............................................. 10-2
Report Generation ................................. 10-3
Web Views ........................................ 10-4
Functions – Alphabetical List
11
Examples
A
Creating Reports .................................. A-2
Generating Reports from MATLAB Files ............. A-3
Creating Web Views ............................... A-4
Working with Components ......................... A-5
Index
xii Contents
_
User’s Guide
Chapter 1, Getting Started (p. 1-1) Overview of Simulink®Report
Generator™ product
Chapter 2, Generate System Design
Description Reports (p. 2-1)
How to create a System Design
Description report for a Simulink
model
Chapter 3, Creating Simulink
Reports (p. 3-1)
A step-by-step example that creates
a Simulink report
Chapter 4, Generate a Report (p. 4-1) How to format and generate reports
Chapter 5, Export Simulink Models
to Web Views (p. 5-1)
How to create interactive renditions
of Simulink models that you can
view in Web browsers
Chapter6,AddContentwith
Components (p. 6-1)
Examples of building report setup
files with various components
Chapter 7, Compare Simulink Model
XML Files (p. 7-1)
Introduces XML comparison
Appendix A, Examples (p. A-1)
1
Getting Started
“Product Description” on page 1-2
“System Design Documentation and Results Reporting” on page 1-3
“Interactive Model Exploration” on page 1-6
“Report Creation Workflow” on page 1-9
“Report Components” on page 1-10
“Report Explorer” on page 1-15
“How Simulink®Report Generator™ and Simulink Software Interact” on
page 1-18
“Supported Report Formats” on page 1-20
“Browser Requirements for Web Views” on page 1-21
1Getting Started
Product Description
Generate documentation for Simulink and Stateflow®models
The Simulink Report Generator product can automatically create
documentation from Simulink and Stateflow models. It lets you document
software requirements and design specifications and produce reports from
your models, all in a standard format.
Key Features
Lets you create interactive renditions of your Simulink and Stateflow
modelsthatcanbeviewedinawebbrowser
Enables push-button documentation of Simulink and Stateflow models
and simulation results
Simulates models and executes MATLAB®commands within reports
Enables conditional documentation generation via logical template
components, such as IF, THEN, ELSE, and WHILE
Lets you create and distribute documentation templates using customized
style sheets
Provides extensible components and style sheets
Creates reports in multiple formats, including HTML, PDF, RTF,
Microsoft®Word, and XML
1-2
System Design Documentation and Results Reporting
System Design Documentation and Results Reporting
In this section...
“Types of Reports” on page 1-3
“System Design Documentation” on page 1-3
“Results Reporting” on page 1-4
Types of Reports
Two common user goals for reports are:
System design documentation — Capture information about the design
decisions, structure, implementation, and operational details of a system.
Results reporting — Present results of running a system.
You use a very similar workflow for creating and generating both kinds of
reports. However, some components are particularly useful for one or the
other kind of report.
System Design Documentation
System documentation has many uses, including:
Capturing design decisions
Recording implementation details
Communicating the system design and interfaces among groups
You can view information about a system without creating a report. For more
information, see “Interactive Model Exploration” on page 1-6.
When you create a Simulink Report Generator report to provide system
design documentation, the report captures information about the system
design directly from the model. Each time that you generate the report, you
see up-to-date documentation for the design.
1-3
1Getting Started
The following table includes some examples of components that are useful for
system design documentation reports.
System Information Examples of Components to Use
Requirements Requirements Summary Table (for
requirements specified with Simulink
Verification and Validation™)
System layout System Hierarchy,System Snapshot
Model configuration Model Configuration Set,Model Advisor
Report
Block parameter settings Simulink Dialog Snapshot,Block Loop
Properties Simulink Property Table,Simulink
Summary Table
Variables Variable Table,Simulink Workspace
Variable
System documentation
included in a model
Documentation,Simulink Name
Results Reporting
Results reporting has many uses, including:
Model regression testing
Verifying and validating designs
Exploring design alternatives
Optimizing designs
Simulink provides several tools for examining the results of a simulation.
Simulation data includes signal, time, output, state, and data store logging
data. You can set up your model to export simulation data to the MATLAB
workspace during simulation for later retrieval, analysis, and postprocessing.
You can use several approaches to explore the simulation data. For details,
see “Export Simulation Data” in the Simulink documentation.
1-4
System Design Documentation and Results Reporting
You can report on results without creating a report. For more information,
see “Interactive Model Exploration” on page 1-6.
The following table includes some examples of components that are useful
results reports.
Results Information Examples of Components to Use
Signal values Scope Snapshot,Block Loop
Simulation processing Model Simulation,Model Configuration
Set,Fixed-Point Logging Options
Figures generated with
MATLAB
Figure Snapshot,To Workspace Plot
Generated code Code Generation Summary,Import
Generated Code
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-5
1Getting Started
Interactive Model Exploration
In this section...
“Simulink®Report Generator™ Tools” on page 1-6
“Simulink Model Exploration Tools” on page 1-7
Simulink Report Generator Tools
The Simulink Report Generator provides tools that you can use to obtain
information about models, without creating report setup files:
Predefined standard reports
Web View
XML Comparison report
Predefined Standard Reports
From the Simulink Model Editor, you can access two predefined, standard
Simulink Report Generator reports:
System Design Description
Design Requirements (requires Simulink Verification and Validation)
The System Design Description report provides summary or detailed
information about a system design represented by a model. You can choose
report options with the report dialog box, or you can create a customized
version using the Report Explorer. For details, see “Generate a System
Design Description” on page 2-7.
You can use the System Design Description report setup file as a starting
point for creating a setup file for your own report.
You can also generate an HTML model report for Stateflow charts.
You must have the Simulink Verification and Validation product installed
to use the Design Requirements report. The Design Requirements report
includes information about all the requirements associated with the model
1-6
Interactive Model Exploration
and its objects. For details, see “Creating and Customizing a Requirements
Report” in the Simulink Verification and Validation documentation.
Web View
A Web view is an interactive rendition of a model that you can view in a
Web browser. You can use Web views to navigate hierarchically to specific
subsystems and see properties of blocks, signals, and scopes. You can zoom
in and out, pan, and fit your model to your view using the same keyboard
shortcuts that you use in Simulink and Stateflow editors.
Web views are useful for presenting models to audiences and for sharing
models with colleagues who do not have MathWorks®products installed.
For details, see “Export Models to the Web” on page 5-3.
XML Comparison Report
You can use Simulink Report Generator software to compare XML text
renditions of different versions of a Simulink model and to compare the XML
renditions to explore differences between versions of the model. You can also
compare the XML text renditions of two different models.
For details, see “Model Comparison”.
Simulink Model Exploration Tools
You can generate a model report, which is an HTML document that describes
the structure and content of a model. The model report includes block
diagrams of the model and its subsystems and the settings of its block
parameters. To generate the report, from the Simulink Model Editor, select
File > Print Details. For more information, see “Generate a Model Report”.
To interactively focus on specific elements of a model (for example, blocks,
signals, and properties) without navigating through the model diagram or
chart, using the Model Explorer. To open the Model Explorer, in the Simulink
Model Editor, select View > Model Explorer. For details, see “Model
Explorer Overview”.
1-7
1Getting Started
To generate a report that lists the suboptimal conditions or settings in
a model, with suggestions for better model configuration settings where
appropriate, use the Model Advisor. To open the Model Advisor, in the
Simulink Model Editor, select Analysis > Model Advisor. For details, see
“Consult the Model Advisor”
To navigate a model hierarchically, open systems in a model, and determine
the blocks contained in a model, you can use the Simulink Model Browser. To
open the Model Browser, select View > Model Browser Options > Model
Browser. For details, see “Model Browser”.
Simulink provides several tools for examining the results of a simulation.
Simulation data includes signal, time, output, state, and data store logging
data. You can set up your model to export simulation data to the MATLAB
workspace during simulation for later retrieval, analysis, and postprocessing.
You can use several approaches to explore the simulation data. For example,
you can use the Simulation Data Inspector to generate a report with plots
of simulation data. For details, see “Export Runtime Information” in the
Simulink documentation.
1-8
Report Creation Workflow
Report Creation Workflow
1Open the Report Explorer. In the menu bar on the Simulink model window,
click Tools > Report Generator.
2Create a new report setup file. For more information about report setup
files, see “Report Setup”.
3Add existing Simulink or Stateflow components to the report setup file,
or create your own custom components. For more information on using
components, see “Add Components”.
4Choose an existing stylesheet or create a custom stylesheet to apply styles
and standards to the report setup file. For more information, see “Layout
Stylesheets”.
5Generate the report.
The following figure illustrates a typical Simulink Report Generator workflow.
Open
Report
Explorer
(GUI)
Report Generator
Create
setup
file
Apply
stylesheet
Generate
report
Add
components
Export
Simulink
Web View
Create
Simulink
model
1-9
1Getting Started
Report Components
In this section...
“About Report Components” on page 1-10
“Report Structure Components” on page 1-11
“System-Based Components” on page 1-11
“User-Supplied Information Components” on page 1-13
“Dynamic Reporting Components” on page 1-14
“Format Control at the Component Level” on page 1-14
About Report Components
Components are modules that you include in a report setup file to insert
elements, such as tables, lists, and figures, into a report. You also can use
components to control report generation processing.
Many components have parent-child relationships with other components. For
example, a child components of a Paragraph component include components
such as Text, Image, and Insert Variable.
Use a combination of the following types of components in your report setup
file.
Component Type Description
“Report Structure Components” on
page 1-11
Include a title page, sections, and
other components to organize the
content of a report.
“System-Based Components” on
page 1-11
Include components that
automatically obtain information
directly from a model to include in
a report.
1-10
Report Components
Component Type Description
“User-SuppliedInformation
Components” on page 1-13
Include text and graphics that you
supply, independent of a model.
“Dynamic Reporting Components”
on page 1-14
Set up dynamic control for when
to include components and what
information to report on for a
component, based on data from a
model or on other conditions that
you specify.
Use the Report Explorer to add components to a report and to specify
component properties.
Report Structure Components
To add a title page, use a Title Page component. You can include an abstract
and legal notice information. For an example, see “Add a Title Page” on page
3-13.
To organize a report into sections, use Chapter/Subsection components. For
an example, see “Create a Section for Each Iteration” on page 3-32.
System-Based Components
The Simulink Report Generator includes many components that obtain
information directly from a model and include that information in a report.
Using system-based components allows your report to reflect the current state
of a model. You can generate the report whenever you want to capture the
latest version of a model, without changing the report setup file.
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, as shown in
the following summary table.
1-11
1Getting Started
To use descriptive information from DocBlock blocks, use the Documentation
component.
A few examples of system-based components include:
MATLAB Property Table
Simulink Workspace Variable
System Hierarchy
Simulink Summary Table
Simulink Dialog Snapshot
1-12
Report Components
Block Execution Order List
Model Loop
Model Configuration Set
Scope Snapshot
For examples of using system-based components, see:
“Property Table Components” on page 6-6
“Summary Table Components” on page 6-17
“Create the Body of the Report” on page 3-22
The Simulink Report Generator also includes system-based components that
contain model elements from the following Simulink products:
Stateflow
Simulink Fixed Point™
Simulink Coder™
Simulink Verification and Validation
User-Supplied Information Components
In addition to using system-based components to extract data from a system
and insert that information into a report, you can also add content that you,
or others, supply. For example, to include text, use the Paragraph and Text
components.
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.
For an example, see “Add Introductory Text to the First Chapter”.
1-13
1Getting Started
Dynamic Reporting Components
Dynamic reporting components execute conditionally, enabling you to decide
when a child component executes or how many times a child component
executes. To control the report generation flow, use logical and flow
components such as Logical If,Logical Then,While Loop,orFor Loop.
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.
For examples, see:
“Add Logical Then and Logical Else Components” on page 3-18
“Create the Body of the Report” on page 3-22
Format Control at the Component Level
The output format and stylesheet that you select for a report determines most
aspects of the generated report formatting. For details, see “Report Output
Format and Stylesheet” on page 4-4.
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-14
Report Explorer
Report Explorer
About the Report Explorer
The Report Explorer is the MATLAB Report Generator and Simulink Report
Generator graphical user interface (GUI). It allows you to:
Create and modify report setup files.
Apply stylesheets to format the generated report.
Specify the report file format.
Generate reports.
To open the Report Explorer, enter report in the MATLAB Command
Window.
1-15
1Getting Started
Library pane
The Report Explorer has three panes:
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.
1-16
Report Explorer
Outline Pane Context Library Pane Contents
No report setup file is open. Reports
Report setup file is open. Components
Stylesheet is open. Stylesheet attributes
The Properties pane contents depend on the Outline pane context. If no
report setup file is open, on the right displays tasks the Report Explorer
can perform. If a report setup file is open, the Properties pane displays the
properties for the item that is currently selected in the Library pane.
OutlinePaneContext Properties Pane Contents
No report setup file is open. Tasks that the Report Explorer can
perform
Report setup file is open. Properties for the item that is
currently selected
After you create a report setup
file, the Properties pane initially
displays properties for the report
setup file as a whole.
Tip If the Report Explorer window opens with only two panes, one of the
panesishidden. Youcanmovetheverticalboundariesbetweenthepanesto
reveal any hidden pane, or to make visible panes wider or narrower.
1-17
1Getting Started
How Simulink Report Generator and Simulink Software
Interact
The Simulink and Simulink Report Generator software interact to create
reports and Web views. The following table describes these interactions.
User
Interface
Interaction with Simulink Report
Generator software Description
Report
Explorer
The Report Explorer is the Simulink
Report Generator graphical user
interface (GUI). For more information,
see “Report Explorer” on page 1-15.
Use the Report Explorer to edit
existing report setup files, components,
stylesheets, and attributes, or to
customize your own.
Simulink
model
window
Use Simulink model window to:
Export the model to a Web view
Generate a System Design
Description report
Start the Report Explorer to export
the model to a Web view or create
and generate a report
Use the Simulink model window to:
Create reports that incorporate the
current Simulink model
Export the model to a Web view
For more information, see “Web
Display of Model Information”
and “Generate a System Design
Description” on page 2-7.
Simulink Report Generator software also interacts with Simulink Coder and
Stateflow software.
Use report generation capabilities with the Simulink Coder software to:
Create Adobe®Acrobat®PDF and Microsoft Word documents for generated
code.
Use report generation capabilities with the Stateflow software to:
Take snapshots of charts.
Describe truth tables.
Document chart hierarchy.
1-18
How Simulink®Report Generator™ and Simulink®Software Interact
Document object properties.
1-19
1Getting Started
Supported Report Formats
When the report generation process first creates a report, it generates
a DocBook XML source file. You can customize this XML as
needed. For more information, see the OASIS DocBook TC Web
page at http://www.oasis-open.org/committees/docbook and
http://www.docbook.org/tdg/en/html/docbook.html.
Next, the report generation process converts the XML source to one of these
user-specified report formats:
Rich Text Format (RTF)
Hypertext Markup Language (HTML)
Microsoft Word (.doc)
Adobe Acrobat PDF
Note PDF reports only support bitmap (.bmp), jpeg (.jpg), and Scalable
Vector Graphics (.svg)images.
1-20
Browser Requirements for Web Views
Browser Requirements for Web Views
Web views require a Web browser that supports Scalable Vector Graphics
(SVG). Web views use SVG to render and navigate models.
MathWorks recommends the following Web browsers:
Mozilla Firefox Version 1.5 or later, which has native support for SVG. To
download the Firefox browser, see http://www.mozilla.com/.
The Microsoft Internet Explorer®Web browser with the Adobe SVG
Viewer plug-in. To download the Adobe SVG Viewer plug-in, see
http://www.adobe.com/svg/.
Note The MicrosoftInternet Explorer Web browser on Japanese systems
does not support web views.
1-21
1Getting Started
1-22
_
Examples
Use this list to find examples in the documentation.
Examples
Creating Reports
Chapter 3, “Creating Simulink Reports”
“Compare Simulink Model XML Files” on page 7-2
Examples-2
Generating Reports from MATLAB Files
Generating Reports from MATLAB Files
Generate Reports from MATLAB®Files on page 4-20
Examples-3
Examples
Creating Web Views
“Create Web Views of Simulink Models” on page 5-11
Examples-4
Working with Components
Working with Components
“Property Table Components” on page 6-6
“Summary Table Components” on page 6-17
“Dynamic Reporting Components” on page 6-22
Generating Reports on Specified Systems and their Subsystems on page
9-60
Temporarily Omitting a Model from a Loop on page 9-65
Examples-5
2
Generate System Design
Description Reports
“System Design Description” on page 2-2
“Generate a System Design Description” on page 2-7
“Customize the System Design Description” on page 2-10
2Generate System Design Description Reports
System Design Description
In this section...
“Predefined Standard Reports” on page 2-2
“What Is the System Design Description?” on page 2-3
WhatYouCanDowiththeReport”onpage2-3
“Report Contents” on page 2-3
Predefined Standard Reports
From the Simulink Model Editor, you can access two predefined, standard
Simulink Report Generator reports called:
System Design Description
Design Requirements
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” on page 2-7.
You can use the System Design Description report setup file as a starting
point for creating a setup file for your own report.
You can also generate an HTML model report for Stateflow charts. For
details, see “Generate a Model Report”.
The Design Requirements report requires that you have the Simulink
Verification and Validation product installed. The Design Requirements
report includes information about all the requirements associated with
the model and its objects. For details, see “Creating and Customizing
a Requirements Report” in the Simulink Verification and Validation
documentation.
2-2
System Design Description
What Is the System Design Description?
The System Design Description is a prebuilt Simulink Report Generator
report that describes the system design represented by a Simulink model.
By default, the Simulink Report Generator generates the report for the model
from which you invoke the System Design Description report option.
What You Can DowiththeReport
You can use the System Design Description to
Review a system design without having the model open
Generate summary and detailed descriptions of the design
Assess compliance with design requirements
Archive the system design in a format independent of the modeling
environment
Build a customized version of the report, using the Report Explorer
Note To view step-by-step tutorials for creating and generating a report, see
the Introduction to System Design Description Reports example.
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” on page 2-7.
2-3
2Generate System Design Description Reports
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.
2-4
System Design Description
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 root system input and output
signals
Block parameters
-Includes detailed information about
MATLAB Function blocks
Block execution order for root system and
atomic subsystems
Look-up tables
Simulink workspace variables
Model configuration sets
State charts
Requirements (optional)
Subsystems Thesametypeofinformationastheinformation
for the root system, as well as:
Path of the subsystem in the model
(For atomic subsystems) Checksum that
indicates whether the version of an atomic
subsystem that generates the report differs
from other versions of the subsystem
Referenced models (optional)
Subsystems from custom libraries (optional)
State Charts State chart
States
2-5
2Generate System Design Description Reports
Section Information
Transitions between the states
Junctions
Events that trigger state transitions
Data types
Targets
Truth tables
Report Captures Documentation Included in a Model
The System Design Description reports documentation included in a model,
including:
The model description (from the model properties)
The block property Description
DocBlock model documentation blocks
To enrich the generated System Design Description, consider adding
descriptive information in a model in these ways listed above.
2-6
Generate a System Design Description
Generate a System Design Description
In this section...
OpentheSystemDesignDescriptionDialogBox”onpage2-7
“Choose System Design Description Options” on page 2-7
Open the System Design Description Dialog Box
To open the System Design Description dialog box:
1Open the model or subsystem for which you want to generate a report.
2From the Simulink Model Editor File menu, select Reports > System
Design Description. The System Design Description dialog box opens
3Specify layout and content options for the report. For details, see “Choose
System Design Description Options” on page 2-7.
4Click the Generate
Choose System Design Description Options
You can specify options for layout and content, for the following items:
Title page contents
Report content
Report file format and storage location
2-7
2Generate System Design Description Reports
In the dialog box, to display detailed information about each option, right-click
on the option prompt and select the What’s This context-sensitive help.
2-8
Generate a System Design Description
To create a customized version of the report, click the Customize Content
button. The customize 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-10.
2-9
2Generate System Design Description Reports
Customize the System Design Description
In this section...
“Using the Report Explorer to Customize the Report” on page 2-10
“Building a Dialog Box for a Custom Report Setup File” on page 2-11
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.
Bydefault,whenyouopenacustomized version of the report, the System
Design Description dialog box does not open.
Using the Report Explorer to Customize the Report
To customize the System Design Description setup file in the Simulink Report
Generator using the Report Explorer:
1In the System Design Description dialog box, click the Customize Content
button to open the Report Explorer.
2-10
Customize the System Design Description
The Report Explorer reflects any changes (for example, a different report
name) that you made in the System Design Description dialog box.
2In the Report Explorer, add or modify components. See “Add Components”
and “Information Components”.
Do not remove the sdd_custom_data structure, which is defined as:
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,suchas
%StdRpt.getChecksum
3Optionally modify a style sheet (see “Layout Stylesheets”).
4Save the customized report with a name other than SDD_custom.rpt.
Building a Dialog Box for a Custom Report Setup File
To provide options for your custom report, you can create a dialog box, like
the System Design Description dialog box. The dialog box that you create for
your custom report can allow others to adapt the report to meet their needs,
without their having to use the Report Explorer.
2-11
2Generate System Design Description Reports
2-12
3
Creating Simulink Reports
“Create a Simulink®Report Generator™ Report” on page 3-2
“Report Options” on page 3-3
“Add Components to the Report Setup File” on page 3-5
“Error Handling for MATLAB Code” on page 3-53
“Generate the Report” on page 3-55
3Creating Simulink®Reports
Create a Simulink Report Generator Report
This example involves the following tasks:
Inserting models and scopes into reports
Creating tables in reports using workspace data
Evaluating MATLAB expressions
Inserting values of workspace variables into reports
Creating reports with chapters and subsections
Running loops and flow control
Handling errors
It shows you how to use the Report Explorer to design a report setup file and
generate a report that does the following:
Opens a Simulink model for the van der Pol equation, called the 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 run this tutorial.
However, knowledge of these products might be helpful for understanding the
MATLAB code and model simulation that executes.
This tutorial includes separate sections for different kinds of report creation
and generation task. Each section builds on the previous sections. However,
if you want to work through a later section without having done the previous
sections, in MATLAB you can view the completed report setup file: open
Dynamic Simulink Report. The report is for the vdp model.
Note For another set of step-by-step tutorials for creating and generating a
report, see theIntroduction to System Design Description Reports example.
3-2
Report Options
Report Options
To create and configure the report setup file:
1Start a Simulink software session.
2Open the Report Explorer by clicking Tools > Report Generator in the
Simulink model window menu bar.
3Select File > New to create a report setup file.
4Save the report setup file.
In the Properties pane:
aSpecify where to save the report setup file. To save it in the current
working folder, select Present Working Directory from the Directory
selection list.
bSpecify the report format. In the File format selection list, select
Acrobat (PDF).
cEnter a description for the report. In the Report description text box,
replace the existing contents with the following text.
Tip Copy and paste this code from the HTML documentation into the
Report Explorer.
Simulink Dynamic Report
This report opens up a model, sets a block parameter
several times, simulates the model, and collects the
results. Results that fall within a specified range are
displayed in a table after the test is complete.
The report is configured to test the vdp model only.
By selecting the Eval String component immediately
below the Report component, you can modify
* model
* block
3-3
3Creating Simulink®Reports
* parameter
* tested values
5Click File > Save As to save the report setup file as
simulink_tutorial.rpt.
The Outline pane on the left displays the new file name.
3-4
Add Components to the Report Setup File
Add Components to the Report Setup File
In this section...
“Report Components” on page 3-5
“Add MATLAB Code” on page 3-7
“Add a Title Page” on page 3-13
“Open the Simulink Model” on page 3-15
“Add Logical Then and Logical Else Components” on page 3-18
“Error If Model Cannot Be Opened” on page 3-19
“Create the Body of the Report” on page 3-22
“Process with a Model Loop Component” on page 3-23
“Add a Paragraph for Each Model” on page 3-25
“Insert a Snapshot of the Model” on page 3-27
“Add a Loop for Processing the Model” on page 3-28
“Block Parameter Value from a MATLAB Expression” on page 3-30
“Create a Section for Each Iteration” on page 3-32
“Insert the Block Value” on page 3-33
“Set a Parameter Value” on page 3-34
“Check Value Using a Logical If Component” on page 3-36
“Simulate the Model Using a Model Simulation Component” on page 3-39
“Create a Post-Test Analysis Section” on page 3-45
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.
For more information, see “Report Components” on page 1-10.
3-5
3Creating Simulink®Reports
The following figure shows a sample page from the report you create in this
tutorial, and which components you use to produce this output.
Note Do not deactivate report components that you add to the report setup
file.
Chapter/Subsection
component
Paragraph
component
System Snapshot
component
Chapter/Subsection
component
Insert Variable
component
Scope
Snapshot
component
3-6
Add Components to the Report Setup File
Add MATLAB Code
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
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 tutorial.
1In the Outline pane on the left, select simulink_tutorial.rpt.
2In the Library pane in the middle, under the MATLAB category, select
Evaluate MATLAB Expression.
3In 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.
3-7
3Creating Simulink®Reports
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’s 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.
3-8
Add Components to the Report Setup File
4Clear 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.
5Add MATLABcodetotheExpression to evaluate in the base
workspace text box to specify the following values:
The model name
The block name
The block parameter
3-9
3Creating Simulink®Reports
Parameter values
Other initial values required for processing the vdp model
Replace the existing text with the following MATLAB code.
%The name of the model
%that will be changed
expModel='vdp';
%The name of the block in the model
%that will be changed
expBlock='vdp/Mu';
%The name of the block parameter
%that will be changed
expParam='Gain';
%The values that will be set
%during experimentation
expValue=[-1 0 .5 1 2];
%expValue can be either a vector
%or a cell array
testMin=2.1;
testMax=3;
%---- do not change code below line ---
try
open_system(expModel);
end
expOkValues=cell(0,2);
3-10
Add Components to the Report Setup File
Note When you change a field in the Properties pane on the right, the
fieldbackgroundchangescolor(thedefault 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.
6Select the Evaluate this expression if there is an error check box.
7In the field under the check box, replace the existing text with the following
text:
disp(['Error during eval: ', evalException.message])
The Report Explorer window now looks as follows.
3-11
3Creating Simulink®Reports
3-12
Add Components to the Report Setup File
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.
8Click File > Save to save the report setup file.
For information about handling error conditions, see “Error Handling for
MATLAB Code” on page 3-53.
Add a Title Page
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
Create a custom title page for your report using the Title Page component.
1In the Outline pane on the left, select the Eval component.
2In the Library pane in the middle, under the Formatting category, click
Title Page.
3-13
3Creating Simulink®Reports
3Click the iconnexttoAdd component to current report.
The Title Page component appears in the Outline pane.
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 tutorial you add Chapter components to this report, you can ignore
that message.
4In the Properties pane on the right:
aIn the Title text box, enter:
Dynamic Simulink Report
bIn the Subtitle text box, enter:
3-14
Add Components to the Report Setup File
Using Simulink Report Generator to Document Changes
cIn the Options section, choose Custom Author from the selection list.
dEnteryournameinthetextbox.
eSelect the Include report creation date check box.
fSelect the default date and time format from the selection list. The
Properties pane on the right looks as follows.
5Save the report setup file.
Open the Simulink Model
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
3-15
3Creating Simulink®Reports
The following statement in the Evaluate MATLAB Expression component
thatyoucreatedin“AddMATLABCode”onpage3-7triestoopenthevdp
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 vdp model was successfully opened, test the result of the
open_system command using a Logical If component.
1In the Outline pane on the left, select the Title Page component.
2In 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.
3In 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.
3-16
Add Components to the Report Setup File
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 3-18 explainshowtoaddtwochildcomponents
to the if component.
4In the Properties pane on the right, in the Test expression text box,
replace thedefaulttext,true, with the following text:
strcmp(bdroot(gcs),expModel)
The strcmpfunction compares the name of the open Simulink model and
the value of expModel,whichwassetto'vdp'.Itteststoseeifthevdp
model opened successfully. strcmp returns 1(true)ifthetwostrings
match, and 0(false)ifnot.
5Save the report setup file.
The if componentnameintheOutlinepanechangestoincludethe
expression that you added.
3-17
3Creating Simulink®Reports
Add Logical Then and Logical Else Components
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
The if strcmp(bdroot(gcs), expModel)) component has two possible
results. Add two child components to the report setup file to process these
cases.
1In the Outline pane on the left, select the if component.
2In the Library pane in the middle, under the Logical and Flow Control
category, double-click Logical Then.
3In the Outline pane on the left, select the if component again.
4In 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.
3-18
Add Components to the Report Setup File
5To 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.
6Save the report setup file.
Error If Model Cannot Be Opened
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
3-19
3Creating Simulink®Reports
If the if strcmp(bdroot(gcs), expModel)) component fails (the vdp model
cannot open), the else component executes. Display an error message in the
report using the Chapter/Subsection component.
1In the Outline pane on the left, select the else component.
2In the Library pane in the middle, under the Formatting category,
double-click Chapter/Subsection toadditasachildoftheelse
component. This component displays an error message if an error occurs
when opening the vdp model.
3-20
Add Components to the Report Setup File
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.
3In the Properties pane on the right, choose Custom from the Title selection
list, and then enter the following text in the text box:
Load Model Failed.
Save the report file.
The Outline pane looks as follows.
4In the Outline pane on the left, select the Chapter component.
5In the Library pane in the middle, under Formatting, double-click
Paragraph.
6In the Properties pane on the right, enter the following text in the
Paragraph Text text box to display the following error message:
Error: Model %<expModel> could not be opened.
The expression %<expModel> indicates that the value of the workspace
variable expModel is inserted into the text, as in the following example.
Error: Model vdp could not be opened.
3-21
3Creating Simulink®Reports
7In the Outline pane on the left, select the Chapter/Section component.
8Save the report setup file.
The Outline pane looks as follows.
Create the Body of the Report
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
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:
“Process with a Model Loop Component” on page 3-23
“Add a Paragraph for Each Model” on page 3-25
“Insert a Snapshot of the Model” on page 3-27
“Add a Loop for Processing the Model” on page 3-28
“Block Parameter Value from a MATLAB Expression” on page 3-30
3-22
Add Components to the Report Setup File
“Create a Section for Each Iteration” on page 3-32
“Insert the Block Value” on page 3-33
“Set a Parameter Value” on page 3-34
“Check Value Using a Logical If Component” on page 3-36
“Simulate the Model Using a Model Simulation Component” on page 3-39
“Create a Post-Test Analysis Section” on page 3-45
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 3-18.
Process with a Model Loop Component
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.
The report changes the Gain parameter for the Mu block in the vdp model
several times. This task requires a Model Loop component.
1In the Outline pane on the left, select the then component.
2In the Library pane in the middle, scroll down to the Simulink category,
and then double-click Model Loop.Itisaddedasachildofthethen
component.
3-23
3Creating Simulink®Reports
The Properties pane on the right looks as follows.
3-24
Add Components to the Report Setup File
3In the Properties pane on the right:
aSelect the Active check box to process the vdp model.
bIn the Traverse model selection list, select Selected system(s) only
to traverse only the vdp model.
cSelect Model root from the Starting system(s) selection list.
dAt the bottom of the Properties pane on the left, select the Create
section for each object in loop check box to create a chapter or section
for each model. When you select this check box, the component name in
the Outline pane on the left changes to Model Loop Chapter.
eSelect the Display the object type in the section title check box to
include the object type (in this example, model) in the title name.
fClear the Create link anchor for each object in loop check box.
4Save the report setup file.
Add a Paragraph for Each Model
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
3-25
3Creating Simulink®Reports
In each Model Loop Chapter, add an explanation using the Paragraph
component.
1In the Outline pane on the left, select the Model Loop Chapter component.
2In the Library pane in the middle, scroll up to the Formatting category,
and then double-click Paragraph.TheParagraph component is added as
achildoftheModel Loop Chapter component.
3In 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
the results. In this report, you load the model %<expModel>
and simulate it %<length> times. This report modifies the
%<expBlock> block's "%<expParam>" value, setting it to the
values %<expValue>. Each iteration of the test includes
a set of scope snapsnots in the report.
When this report is generated, the variable names preceded by percent
signs (%) and enclosed in brackets (<>) are replaced with the values of those
variables in the MATLAB workspace.
4Save the report setup file.
3-26
Add Components to the Report Setup File
Insert a Snapshot of the Model
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
Inside each Model Loop Chapter component, include a snapshot of the
current model using the System Snapshot component.
1In the Outline pane on the left, select the Model Loop Chapter component.
2In 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.
3In the Properties pane on the right:
3-27
3Creating Simulink®Reports
aSelect Zoom from the Scaling selection list.
bEnter 70 as the %value.
4In the Outline pane on the left, select the System Snapshot component.
5Click the down arrowonthetoolbaroncetomoveitundertheParagraph
component.
6Save the report setup file.
Add a Loop for Processing the Model
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
Create a loop to process the model %length times using the For Loop
component.
1In the Outline pane on the left, select the System Snapshot component.
2In the Library pane in the middle, under the Logical and Flow Control
category, double-click For Loop.TheFor Loop component is added as a
sibling of the System Snapshot component.
3-28
Add Components to the Report Setup File
3In the Properties pane on the right:
aIn 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 5in this example.
bIn the Variable name text box, replace the existing text with the name
of the for loop variable. Enter the following text:
expIteration
ThenameoftheFor component in the Outline pane on the left changes
to reflect the loop variable and the termination value.
3-29
3Creating Simulink®Reports
4Save the report setup file.
Block Parameter Value from a MATLAB Expression
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
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.
1In the Outline pane on the left, select the for component.
2In the Library pane in the middle, under the MATLAB category, double-click
Evaluate MATLAB Expression. In the Outline pane, the component name
is shortened to Eval.
3-30
Add Components to the Report Setup File
3On the Properties pane on the right:
aClear the Insert MATLAB expression in report and Display
command window output in report check boxes.
bEnter the following text in the Expression to evaluate in the base
workspace text box:
%Evaluate this string in the base workspace
if iscell(expValue)
Iteration_Value=expValue{expIteration};
else
Iteration_Value=...
num2str(expValue(expIteration));
end
The Iteration_Value variable represents the designated array element.
cClear the Evaluate expression if there is an error check box.
4Save the report setup file.
3-31
3Creating Simulink®Reports
Create a Section for Each Iteration
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
Create a separate section for each iteration of the loop that includes the data
using the Chapter/Subsection component.
1In the Outline pane on the left, under the for component, select the Eval
component.
2In the Library pane in the middle, under the Formatting category,
double-click the Chapter/Subsection component 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).
3-32
Add Components to the Report Setup File
3In the Properties pane on the right:
aIn the Title selection list, select Custom.
bIn the text box, enter the following title:
Processing the vdp model
This indicates that the section title comes from the first child component.
Do not change any other properties.
4Save the report setup file.
Insert the Block Value
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
Insert the Gain value that is used for each simulation.
1In the Outline pane on the left, select the Section 1 component.
2In the Library pane in the middle, under the MATLAB category, double-click
Insert Variable.
3In the Properties pane on the right:
aIn the Variable name text box, enter Iteration_Value.
bIn the Display as selection list, select Paragraph.
The Properties pane on the right looks as follows.
3-33
3Creating Simulink®Reports
4Save the report setup file.
Set a Parameter Value
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
For each iteration, set the Gain parameter to the value that you extracted
from the expValue array.
1In the Outline pane on the left, select the Variable component.
3-34
Add Components to the Report Setup File
2In the Library pane in the middle, under the MATLAB category, double-click
Evaluate MATLAB Expression. This component is added as a sibling of
the Variable component.
3In the Properties pane on the right, clear the Insert MATLAB expression
in report and Display command window output in report check
boxes.
4In 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 vdp model to the value of Iteration_Value.
5Make sure you select Evaluate expression if there is an error.Enter
the following text into the text box:
okSetValue=logical(0);
If the set_param command works, okSetValue is set to 1. If an error
occurs, okSetValue is set to 0. The next component then reports the error
and terminates processing.
6Save the report setup file.
The Outline pane on the left looks as follows.
3-35
3Creating Simulink®Reports
CheckValueUsingaLogicalIfComponent
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
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.
1In the Outline pane on the left, select the Eval component for the
set_param command.
2In 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-36
Add Components to the Report Setup File
3In the Properties pane on the right, in the Test expression text box,
replace true with okSetValue.
okSetValue canbe1(true)or0(false), so insert two components —
Logical Then and Logical Else — to process those conditions:
1In the Outline pane on the left, select the if(okSetValue) component.
2To insert Logical Then and Logical Else in the correct order:
aIn the Library pane in the middle, double-click the Logical Else
component.
bSelect the if(okSetValue) component again.
cDouble-click the Logical Then component. The Outline pane on the
left looks as follows.
3-37
3Creating Simulink®Reports
3In the Outline pane on the right, select the else component.
4In the Library pane in the middle, double-click Paragraph.
If okSetValue =0,theGain parameter value is not set and the report
displays an error.
5In the Properties pane on the right:
aChoose Custom title from the Title Options selection list.
bEnter Error in the text box next to the selection list.
cEnter the following text into the Paragraph Text text box:
Could not set %<expBlock> "%<expParam>" to value
%<Iteration_Value>.
6Save the report.
3-38
Add Components to the Report Setup File
Simulate the Model Using a Model Simulation
Component
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
Now that the model is open and the Gain parameter is set, use the Model
Simulation component to simulate the vdp model.
1In the Outline pane on the left, select the then component under the if
(okSetValue) component.
2In the Library pane, under the Simulink category, double-click Model
Simulation. In the Outline pane on the left, this component is renamed
Simulate model.
3-39
3Creating Simulink®Reports
3In the Properties pane on the right:
aClear the Use model’s workspace I/O variable names check box.
bIn the Time text box, enter dynamicT.
cIn the States text box, enter dynamicX.
dIn the Output text box, enter dynamicY.
The Properties pane on the right looks as follows.
3-40
Add Components to the Report Setup File
4In the Outline pane on the left, select the Simulate model component.
5In the Library pane in the middle:
aScroll down to the Simulink Blocks category.
bDouble-click Scope Snapshot to add it as a sibling of the Simulink
Model component.
3-41
3Creating Simulink®Reports
This component captures the scope for each iteration.
6In the Properties pane on the right:
aIn the Paper orientation selection list, select Portrait.
bFor the Image size,enter[5 4].
cIn the Scaling selection list, select Zoom.
dEnter 75 for the %value.
7Save the report setup file.
8To test to see if the signal data falls within a specified range, add another
Logical If component:
aIn the Outline pane on the left, select the Scope Snapshot component.
bIn the Library pane in the middle, scroll up to the Logical and Flow
Control category.
cDouble-click the Logical If component.
3-42
Add Components to the Report Setup File
9To test the signal data, replace true in the Test expression text box with
the following in the Properties pane on the right:
max(dynamicX(:,2))>testMin & max(dynamicX(:,2))
10 Save the report.
The Outline pane looks as follows:
11 If this condition is true, the signal data falls within the desired range.
Add aParagraph component to print information about the signal data
in the report.
aIn the Outline pane on the left, select the if component you just added.
3-43
3Creating Simulink®Reports
bIn the Library pane in the middle, under the Formatting category,
double-click Paragraph so that it becomes a child of the if component.
cIn the Properties pane on the right:
iFrom the Title Options selection list, select Custom title.
ii Type Success in the text box.
iii Enter the following text in the Paragraph text text box.
The conditioned signal has a maximum value
of %<max(dynamicX(:,2))>, which lies in the
desired range of greater than %<testMin> and
less than %<testMax>.
12 To save the success values to insert into a table at the end of the iterations,
use an Evaluate MATLAB Expression component.
aIn the Outline pane on the left, select the Paragraph component.
bIn the Library pane in the middle, under the MATLAB category,
double-click Evaluate MATLAB Expression.
An unintended result occurs: the new component is a child of the
Paragraph component.
cTo 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.
3-44
Add Components to the Report Setup File
13 In the Properties pane on the right, for the Eval component:
aClear the Insert MATLAB expression in report and Display
command window output in report check boxes.
bIn 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))}];
cMake sure you select Evaluate this expression if there is an error.
Insert the following text in the text box:
disp(['Error during eval: ', evalException.message])
14 Save the report setup file.
Create a Post-Test Analysis Section
Note This section builds on the step-by-step tutorial presented in “Create a
Simulink®Report Generator™ Report” on page 3-2.
To see the completed report setup file, open Simulink Dynamic Report.The
report is for the vdp model.
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.
1In the Outline pane on the left, select the Model Loop Chapter component.
3-45
3Creating Simulink®Reports
2In the Library pane in the middle, under the Formatting category,
double-click Chapter/Subsection.
The new section appears at the beginning of the chapter.
3-46
Add Components to the Report Setup File
Click the down arrow three times so Section 1 moves to the end of the
Model Loop Chapter component.
3-47
3Creating Simulink®Reports
3In the Properties pane on the right:
aSelect Custom in the Title selection list.
bEnter Post-Test Analysis in the text box.
4In the Outline pane on the left, select the new Section 1 component.
5In the Library pane in the middle, under the Formatting category,
double-click Paragraph. Do not change its properties.
3-48
Add Components to the Report Setup File
6To check whether there are any signal values within the desired
range, check the array expOkValues with a Logical If component. If
expOkValues is empty, there are no signal values in the desired range.
Report the result of this check.
aIn the Outline pane on the left, select the Paragraph component and
add a Logical If child component.
bIn the Properties pane on the right, enter the expression to evaluate
in the Test expression text box:
~isempty(expOkValues)
This expression evaluates to 0(false)ifexpOkValues is empty;
otherwise, it evaluates to 1(true).
cIn the Outline pane on the left, select the if(~isempty(expOkValue))
component and add the Logical Else component as a child.
dSelect the if(~isempty(expOkValue)) component again and add the
Logical Then component as a child.
ThetwocomponentsaresiblingsintheOutlinepaneontheleft.
7Save the report setup file.
8Now, insert report components to handle the case where expOkValues is
empty; that is, where no signal values fall within the designated range.
aIn the Outline pane on the left, select the else component.
bIn the Library pane in the middle, double-click the Text component to
add it as a child of the else component.
cIn the Properties pane on the right, in the Text to include in report
text box, enter the following:
None of the selected iteration values had
3-49
3Creating Simulink®Reports
a maximum signal value between %<testMin> and %<testMax>.
9Now handle the case where expOkValues is not empty and you want to
insert a table of the acceptable signal values.
aIn the Outline pane on the left, select the then component.
bAdd a Text component as a child to the then component.
cIn the Properties pane on the right, in the Text to include in report
text box, enter the following text.
%<size(expOkValues, 1)> values for %<expBlock> were
found that resulted in a maximum signal value greater
than %<testMin> but less than %<testMax>. The following
table shows those values and their resulting signal maximum.
dIn the Outline pane on the left, select the Text component under the
then component of the if(~isempty(expOkValues) component.
10 To create an array for use when formatting the table, use the Evaluate
MATLAB Expression component.
aIn the Library pane in the middle, double-click Evaluate MATLAB
Expression.
bIn the Properties pane on the right:
iClear 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:
expOkValues=[{'Mu Value','Signal Maximum'} expOkValues];
iii Make sure you select the Evaluate this expression if there is an
error check box. Enter the following text into the text box:
disp(['Error during eval: ', evalExpression.message])
3-50
Add Components to the Report Setup File
11 In the Outline pane on the left, select the Eval component.
12 In the Library pane in the middle, under the Formatting category,
double-click the Table component so it becomes a sibling of the Text and
Eval components.
13 In the Properties pane on the right:
aIn the Workspace variable name text box, enter expOkValues.The
Simulink Report Generator software uses the contents of expOkValues
to construct the table.
bIn the Table title text box, enter Valid Iteration Values.
14 Save the report setup file.
The Outline pane on the left looks as follows.
3-51
3Creating Simulink®Reports
3-52
Error Handling for MATLAB®Code
Error Handling for MATLAB Code
You can add MATLAB code to a report, by using the Evaluate MATLAB
Expression component (also called the Eval component). See “Add MATLAB
Code” on page 3-7 for details.
TheEvaluateMATLABExpressioncomponent dialog box includes an
Evaluate this expression if there is an error check box. The dialog box
includes default error handling code that you can use, or you can create your
own error handling code.
If you do not change the default error handling code, then when you generate
the report, and there is an error in the MATLAB code that you added:
If you clear Evaluate this expression if there is an error check box,
then the complete report is generated, without displaying an error message
at the MATLAB command line.
If you select Evaluate this expression if there is an error check box,
then the complete report is generated and an error message appears at
the MATLAB command line.
To stop report generation when an error occurs in the MATLAB code that
you added, change the second and third lines of the following default error
handling code, as described below:
warningMessageLevel = 2;
displayWarningMessage = true;
failGenerationWithException = false;
failGenerationWithoutException = false;
To stop report generation and display an exception, change the default code to:
displayWarningMessage = false;
failGenerationWithException = true;
To stop report generation without displaying an exception, change the default
code to:
displayWarningMessage = false;
failGenerationWithoutException = true;
3-53
3Creating Simulink®Reports
If you want to completely replace the default error handling code, use the
evalException.message variable in your code to return information for the
exception.
3-54
Generate the Report
Generate the Report
Now the report includes all required components. To generate the report,
click the Report icon on the toolbar. The following occurs:
1A 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, as shown in the following figure.
Message level 3 (Important messages) is used for the remainder of
this example.
3-55
3Creating Simulink®Reports
2The vdp model appears. You can see each time it is simulated.
3The scope window appears. The scope graph changes each time the
parameter value changes.
4Each component of the report is highlighted as it executes, in the Outline
pane on the left in the Report Explorer window.
When the report is complete, Adobe Acrobat Reader opens your report in
PDF format.
3-56
Generate the Report
3-57
3Creating Simulink®Reports
3-58
4
Generate a Report
“Generate a Report” on page 4-2
“Set Report Output Options” on page 4-4
“Change Report Locale” on page 4-15
“Convert XML Documents” on page 4-16
“Create a Log File” on page 4-19
“Generate MATLAB Code from Report Setup File” on page 4-20
“Legacy Report Setup Files” on page 4-23
“Troubleshooting Report Generation Issues” on page 4-25
4Generate a Report
Generate a Report
In this section...
“Run a Report” on page 4-2
“Report Output Options” on page 4-2
Run a Report
You can generate a Simulink Report Generator report using one of these
methods:
In the Report Explorer Outline pane, select a report and do one of the
following actions:
-In the Report Explorer toolbar, click the Report button ( ).
-Press CTL+R.
-Select File > Report.
From the MATLAB command line, use the report command. For example,
to print the system1_description report in PDF format, use:
report system1_description -fpdf
Report Output Options
Before you generate a report, you can set options to control aspects of report
generation processing such as:
Output file format (PDF, HTML, or Microsoft Word)
Stylesheet for the selected output file format, to control the layout of the
report (for example, whether to display a title page, font, and section
numbering)
Output file location
Whether to regenerate image files
Whether to view the generated report automatically
4-2
Generate a Report
For details, see:
“Report Output Format and Stylesheet” on page 4-4
“Output File Location” on page 4-12
“Regenerate Images” on page 4-13
“Create a Log File” on page 4-19
“Add Description of Report Setup” on page 4-14
“Change Report Locale” on page 4-15
4-3
4Generate a Report
SetReportOutputOptions
In this section...
“Report Output Format and Stylesheet” on page 4-4
“PDF Stylesheets” on page 4-7
“Web Stylesheets” on page 4-8
“RTF (DSSSL Print) and Word Stylesheets” on page 4-9
“Report Generation Processing” on page 4-9
“Output File Location” on page 4-12
“Regenerate Images” on page 4-13
“Add Description of Report Setup” on page 4-14
Report Output Format and Stylesheet
In the Report Explorer, in the Report Options pane, choose the report output
format in the File format text box. For example, if you want to use Microsoft
Word, choose Word document or Rich Text Format.
Each output format has a default stylesheet associated with it. Specify the
stylesheet in the text box next to the File format text box.
The following table shows which output format to use with different software,
and which stylesheets you can use with each output format.
4-4
SetReportOutputOptions
Viewer Format Description Stylesheets
Adobe
Acrobat
Reader
Adobe Acrobat
(PDF)
Produces a PDF
that you can
view using Adobe
Acrobat Reader
software
PDF (see “PDF
Stylesheets”)
Web browser Web (HTML)
(default)
Use for
publishing on
the World Wide
Web
Web (see “Web
Stylesheets”)
Word
processor
Rich Text
Format (RTF)
or Word
Document
Compatible
with most
word-processing
packages,
including
Microsoft Word
software
Print (see “RTF
(DSSSL Print) and
Word Stylesheets”)
DocBook DocBook
(XML)
Produces a
report in
DocBook format
N/A
Note For reports that use the Word Document format, you must have
Microsoft Word software installed on the machine that you use to generate
the report.
Tip To create and use customized styles, see “Create a New Stylesheet”.
Change the Default Output Format
In the Report Generator Preferences pane, use the Format ID preference to
specifythedefaultoutputformatforreports.
4-5
4Generate a Report
Stylesheets
For each output format, you can choose from several stylesheets for each
report output format. For details, see:
“PDF Stylesheets” on page 4-7
“Web Stylesheets” on page 4-8
“RTF (DSSSL Print) and Word Stylesheets” on page 4-9
Note Some Web and Print stylesheets include an automatically generated
list of titles. The list of titles includes a list of table titles and a list of figures
with titles.
Image Format
In the Report Generator Preferences pane, use the following preferences to
specify the default image file format.
Preference Purpose
Simulink Images Specify the format for Simulink images to
include in the report. The default is PNG 24-bit
image.
Stateflow Images Specify the format for Stateflow charts to
include in the report. The default is PNG 24-bit
image.
HG Images Specify the format for Handle Graphics images
to include in the report. The default is PNG
24-bit image.
4-6
SetReportOutputOptions
PDF Stylesheets
PDF Stylesheet Description
Default print
stylesheet
Displays title page, table of contents, list of titles
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
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
4-7
4Generate a Report
Web Stylesheets
Web Stylesheet Description
Default HTML
stylesheet
HTML on a single page
Simulink book HTML
stylesheet
HTML on multiple pages; suppresses chapter
headings and table of contents
Truth Table HTML
stylesheet
HTML on multiple pages; suppresses chapter
headings and table of contents
Multi-page Web HTML, with each chapter on a separate page
Single-page Web HTML on a single page
Single-page
Unnumbered Chapters &
Sections
HTML on a single page; chapters and sections
are not numbered
Single-page Numbered
Chapters & Sections
HTML on a single page; chapters and sections
are numbered
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 numbered
4-8
SetReportOutputOptions
RTF (DSSSL Print) and Word Stylesheets
RTF or Word Stylesheet Description
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
Report Generation Processing
Report Explorer Report Options
In the Report Explorer, in the Report Options pane includes several options
for controlling report processing.
4-9
4Generate a Report
Option Purpose
View report after
generation
Select this option to view the report
automatically. When report generation is
complete, the viewer associated with the report
output format displays the report.
To view the report manually, browse to the
location specified in the Report File Location
section in the Properties pane on the right, and
open the file.
Auto save before
generation
To automatically save the report setup file
before you generate a report, select Auto save
before generation.
Compile model to
report on compiled
information
By default, the Simulink Report Generator
reports uncompiled values of Simulink
parameters. The uncompiled values of some
parameters, such as signal data types, can
differ from the compiled values used during
simulation. To ensure that a report reflects
compiled values, select the Compile model to
report on compiled information option. This
option causes the report generator to compile a
model before reporting on model parameters.
After generating the report, the report generator
returns the model to its uncompiled state.
4-10
SetReportOutputOptions
Option Purpose
Note When you select this option, whenever
report generation requires simulating the
model (for example, the report includes a Model
Simulation component), the report generator
uncompiles the model and then recompiles the
model, if necessary, to report on model contents.
If a report requires multiple compilations, the
processing can be quite time-consuming.
To minimize compilations, consider using
separate reports to report on the contents of
a model and on the results of simulating that
model.
Evaluate this string
after generation
Specify MATLAB code for processing to occur
after the report is generated. For example, you
could specify to close a model.
Report Processing Preferences
The Report Generator Preferences pane provides several preferences to
control report processing.
Preference Purpose
View command Specify the MATLAB command you want to use
to view the report.
Visible in Report
Explorer
Deselect this check box to make the current
output format unavailable in the Report
Explorer interface. For example, if your
specified report format is Word document and
you deselect this check box, then the Microsoft
Word document format is no longer available for
reports created using the Report Explorer.
4-11
4Generate a Report
Preference Purpose
Use version 1.x
environment
Choose this option to use previous versions
of MATLAB Report Generator and Simulink
Report Generator interfaces. For more
information, see “Use Legacy Interface” on page
4-24.
Animate Report
Explorer when
generating reports
Select this check box if you want components in
the Outline pane to be animated as the report
generates. This box is selected by default.
Output File Location
Choose a folder to which you have write privileges, to store the report file. A
list of options appears in the following table.
Report File Location
In the Report Explorer, in the Report Options pane, use the Directory field
to specify the name of the folder in which to store the generated report file.
Specify a folder to which you have write privileges.
The following table summarizes the report file location options.
Folder Option
Thesamefolderasthe
report setup file
Same as setup file
The current working
folder
Present working directory
Temporary folder Temporary directory
Another folder Custom.UsetheBrowse button (...) to select
from a list of directories.
You can use %<VariableName> notation to specify a folder in the Custom text
box. For more information, see “% Notation” on the Text component reference
page in the MATLAB Report Generator documentation.
4-12
SetReportOutputOptions
Report File Name
In the Report Explorer, in the Report Options pane, use the Filename field to
specify a file name for the report file. Select one of the options listed in the
following table.
File Name Option
Thesamefilenameasthe
report setup file
Same as setup file (default)
Afilenamedifferentfromthe
report setup file name
Custom. Enter the name of the report.
Use %<VariableName> notation to specify a file name in the Custom text box.
For more information, see “% Notation” on the Text component reference page
in the MATLAB Report Generator documentation.
Report File Extension
Be default, the report file extension reflects the output format for the report.
For example, if you specify Web (HTML) output, the default extension for
the report file is .html.
To change the default extension, in the Report Generator Preferences pane,
select a Format ID and in the Extension preference, specify an extension.
Image Output File Location
Imagesareplacedinafolderwiththesamenameasthereportfile.
For example, testreport.html images are placed in a folder named
testreport_files.
Regenerate Images
By default, the Regenerate Simulink and Stateflow Images option in the
Generation Options section of the Properties pane on the right is cleared.
As a result, previously generated images are not regenerated each time you
generate a report, so reports generate faster. If you make changes that affect
a generated image, select this option.
4-13
4Generate a Report
Add Description of Report Setup
Use the Report Description field in the Properties pane on the right to
record notes and comments about your report setup. This text appears in the
Properties pane on the right when you select a report setup file in the Outline
pane on the left.
4-14
Change Report Locale
Change Report Locale
Versions 2.0 and later of the MATLAB Report Generator and Simulink Report
Generator software use the locale (system language settings) through the
Sun™ Java™ interface; therefore, they should use the language specified
on your system.
Alternatively, you can change the language directly in Java from the
MATLAB command line. The following example sets the language to Italian:
java.util.Locale.setDefault(java.util.Locale.ITALY)
Alternatively, you can set the preferred language directly in your .rpt file:
1Right-click the Report component and select Send to Workspace.
This displays the properties of the report, which are stored in the variable
ans. Access the report’s Language property from the command line through
this variable. By default, Language is auto, which indicates that the
system’s default language is in use.
2Override thedefaultvalueofLanguage by setting this property to your
desired language; for example, en for English or it for Italian.
4-15
4Generate a Report
Convert XML Documents
In this section...
“Why Convert XML Documents?” on page 4-16
“Convert XML Documents Using the Report Explorer” on page 4-16
“Convert XML Documents Using the Command Line” on page 4-18
“Edit XML Source Files” on page 4-18
Why Convert XML Documents?
You can generate a report in a different output file format without
regenerating it by using either the Report Explorer File Converter or the
rptconvert command. These utilities convert DocBook XML source files
created by the report-generation process into formatted documents such as
HTML,RTF,orPDF.
Note The report-generation process can only convert XML source files
created by the latest version of the software.
Convert XML Documents Using the Report Explorer
To open the Convert Properties pane:
1In the Report Explorer, select Tools > Convert source file.
The Convert Source File Properties pane appears. All XML files in your
current folder appear in the Options pane in the middle.
4-16
Convert XML Documents
2Select your XML source file using one of the following options:
Click Browse inthePropertiespaneontherighttobrowsetothe
location of your XML source.
Double-clickafilenameintheOptionspaneinthemiddleto
automatically enter it into the Source file field in the Properties pane.
3Select your output format and stylesheet:
aIn theFile format text box, select an output format.
bIn theStylesheet text box, select a stylesheet. The stylesheet choice
depends on the specified output format. You can use a predefined or
customized stylesheet.
For more information about available formats and predefined
stylesheets, see “Report Output Format and Stylesheet”.
4-17
4Generate a Report
For more information about customizing stylesheets, see “Create a New
Stylesheet”.
4Use the View Report when done converting check box to indicate
whether you want to view the report after it has conversion.
5To begin the conversion, click Convert file.
Convert XML Documents Using the Command Line
To convert files using the command line, use the rptconvertfunction.
Edit XML Source Files
Before you send a source file to the converter, edit it as text in the Report
Explorer:
1In the Outline pane on the left, open the File Converter.
2Right-click MATLAB Report Generator and select Convert source file.
3In the Options pane in the middle, select the source file to edit.
4In the Properties pane on the right, click Edit as text.
5Use the MATLAB Editor to edit and save the text.
4-18
Create a Log File
Create a Log File
A log file describes the report setup file report-generation settings and
components. A log file can be used for many purposes, including:
As a debugging tool
As a reference to a report setup file
To share information about a report setup file through email
A log file includes the following information:
Report setup file outline
Components and their attributes
Generation status messages currently displayed in the Generation
Status tab
To generate a log file, click File > Log File. An HTML version of the log file
with the name <report_template_file_name_log>.html is saved in the
same folder as the report setup file.
4-19
4Generate a Report
Generate MATLAB Code from Report Setup File
You can generate MATLAB code versions of report setup files in the form
of a MATLAB file (*.m). AMATLABfileofareportsetupfileisusefulfor
various purposes, including generating reports and modifying report setup
files programmatically.
To generate a MATLAB file, load a report setup file into the Report Explorer
and click File > Generate MATLAB File. After the MATLAB file generates,
it opens in the MATLAB Editor. The filename for the generated file is the file
name of the report setup file , preceded by “build.”
Generate Reports from MATLAB Files
This example generates a MATLAB file from the figloop_tutorial.rpt
report setup file, which is part of the MATLAB Report Generator software.
The example then uses the report function to generate a report from the
MATLAB file. For more information about this function, see the report
reference page.
1Start the Report Explorer by entering report in the MATLAB Command
Window.
2In the Options pane in the middle, double-click figloop_tutorial.rpt
to open its report setup file.
3In the Outline pane on the left, click Report - figloop_tutorial.rpt
to select it.
4In the Report Explorer menu bar, click File > Generate MATLAB File.
The MATLAB Report Generator software generates MATLAB code for
the figloop_tutorial.rpt report setup file. It saves this code in the
buildfigloop_tutorial.m file in the folder you specify. Part of this file
appears in the following figure.
4-20
Generate MATLAB®Code from Report Setup File
5To generate the figloop_tutorial report from this MATLAB file, run the
following command in the MATLAB Command Window:
report(buildfigloop_tutorial);
The MATLAB Report Generator software runs and displays the report.
4-21
4Generate a Report
4-22
Legacy Report Setup Files
Legacy Report Setup Files
In this section...
“What Are Legacy Report Setup Files?” on page 4-23
“Enable Legacy Interface” on page 4-23
“Use Legacy Interface” on page 4-24
What Are Legacy Report Setup Files?
Legacy report setup files are files that you created in previous versions of the
MATLAB Report Generator or Simulink Report Generator software. You can
load legacy report setup files in the current version of the Report Explorer.
Alternatively, you can use earlier versions of the product interfaces to work
with legacy report setup files.
Enable Legacy Interface
Enable the previous versions of the interfaces at the MATLAB command line:
RptgenML.v1mode(true)
The result is:
ans =
1
Alogical1indicates that Version 1 mode is on. To turn off Version 1 mode,
enter:
RptgenML.v1mode(false)
The result is:
ans =
0
Alogical0indicates that Version 1 mode is off.
4-23
4Generate a Report
Use Legacy Interface
When you enable Version 1 mode, you can use previous versions of MATLAB
Report Generator or Simulink Report Generator interfaces.
When using earlier versions of these interfaces, the following restrictions
apply:
You cannot use a report setup file created in the latest version of the
MATLAB Report Generator or Simulink Report Generator software with
earlier interfaces. If you save a legacy report setup file in the latest version
of the software, you can no longer work with the same report setup file
in the old interface.
You cannot use the old interfaces with the latest version of the MATLAB
Report Generator or Simulink Report Generator software. The Report
Template Editor can coexist with the Report Explorer, but MathWorks does
not recommend using these interfaces together.
4-24
Troubleshooting Report Generation Issues
Troubleshooting Report Generation Issues
In this section...
“Memory Usage” on page 4-25
“HTML Report Display on UNIX Systems” on page 4-25
Memory Usage
By default, the MATLAB software sets a limit of 100 MB on the amount of
memory the Sun Java Virtual Machine (JVM™) software can allocate. The
memory that the report generation process uses to build a document must fit
within this limit. If you are having trouble processing large reports, it might
be helpful to increase the amount of memory that MATLAB Report Generator
and Simulink Report Generator software can allocate. See the following
sections for more information.
Run the MATLAB Software Without a Desktop
One way to increase the amount of JVM memory available to the MATLAB
Report Generator and Simulink Report Generator software is to run the
MATLAB software with -nodesktop mode enabled.
Note This option is available on UNIX®platformsonly.(UNIXisaregistered
trademark of The Open Group in the United States and other countries.)
Increase the MATLAB JVM Memory Allocation Limit
To increase the amount of JVM memory available by increasing the MATLAB
JVM memory allocation limit, from the MATLAB Toolstrip, in the Home tab,
in the Environment section, select Preferences.UsetheGeneral > Java
Heap Memory dialog box.
HTML Report Display on UNIX Systems
HTML reports may not automatically display on some UNIX platforms. To
work around this issue, configure the MATLAB Report Generator software to
launch an external browser:
4-25
4Generate a Report
1In the Report Explorer, click File > Preferences.
2Enter the following text in the View command field:
web(rptgen.file2urn('%file name'), '-browser')
Where file name is the name of your report setup file.
4-26
5
Export Simulink Models to
Web Views
“Web Views” on page 5-2
“Export Models to the Web” on page 5-3
“Navigate Web Views” on page 5-7
“Create Web Views of Simulink Models” on page 5-11
“Troubleshooting Web Views” on page 5-21
5Export Simulink®Models to Web Views
Web Views
A Web view is an interactive rendition of a model that you can view in a
Web browser. You can use Web views to navigate hierarchically to specific
subsystems and see properties of blocks, signals, and scopes. You can zoom
in and out, pan, and fit your model to your view using the same keyboard
shortcuts that you use in Simulink and Stateflow editors.
You need the Simulink Report Generator software to create Web views. Web
views require that your Web browser support Adobe SVG, implemented
natively or through a plug-in. You do not have to install MathWorks products
to use Web views. Therefore, Web views are useful for presenting models to
audiences and for sharing models with colleagueswhodonothaveMathWorks
products installed. The MATLAB Web browser does not support Web views.
5-2
Export Models to the Web
Export Models to the Web
In this section...
“Open the Export Interface” on page 5-3
“Set Export Options” on page 5-3
“Generate and Review Web Views” on page 5-5
OpentheExportInterface
You can export a model to a Web view using either a Simulink Report
Generator dialog box or a Report Explorer pane.
To Open the export
interface from ... Use ...
Export interface
opens as...
Report Explorer Tools > Export
Simulink to Web
Report Explorer
Simulink Editor File > Export > Export
Model to Web
Dialog box
Stateflow Editor File > Export > Export
Model to Web
Dialog box
Command line The slwebview
function, with no
arguments
Report Explorer
SetExportOptions
You can set options that specify which Simulink systems or Stateflow charts
to export to a Web view, including:
Whether to export Simulink systems or Stateflow charts that include (or
are children of) the current system or chart. For more information, see
“Include Systems” on page 5-4.
Which masked blocks, if any, to include. For more information, see “Look
Under Masks” on page 5-4.
5-3
5Export Simulink®Models to Web Views
Whether to follow links to library blocks. For more information, see “Follow
Library Links” on page 5-5.
Whether to follow model reference blocks. For more information, see
“Follow Model Reference Blocks” on page 5-5.
Tip This section describes how to specify Web view export options using the
Web Views dialog box. For information about how to specify these options
using the command line, see the slwebview function reference page.
Include Systems
Specifies which Simulink systems or Stateflow charts to export.
Include Systems Option Value Meaning
Current Export only the Simulink system
that is open in the model window or
the Stateflow chart that is open in
the diagram editor
Current and above Export the current Simulink system
or Stateflow chart and all systems or
charts that contain it
Current and below Export the current Simulink
system or Stateflow chart and all
subsystems or subcharts that it
contains
All (Default) Export all Simulink systems or
Stateflow charts in the model
Look Under Masks
This option is available only when you choose Current and below or All for
Include Systems. It specifies which masked blocks, if any, to export from
Simulink subsystems or Stateflow subcharts.
5-4
Export Models to the Web
Look Under Masks Option Value Meaning
No masked blocks Donotexportanymaskedblocks
Masks with no workspace and no
dialog (Default )
Export only graphical masked
blocks—those that have no
workspaces and no dialog boxes
Masks with no dialog Export only functional masked
blocks—those that have no dialog
boxes
All masked blocks Export all masked blocks
Follow Library Links
Specifies whether to follow links into library blocks.
Follow Library Links Option
Value Meaning
Selected Follow links into library blocks
Unselected (Default) Do not follow links into library blocks
Follow Model Reference Blocks
Specifies whether to follow links into referenced models.
Follow model reference blocks
Option Value Meaning
true Follow links into referenced models
false (Default) Do not follow links into referenced
models
Generate and Review Web Views
The Web view export process exports the system or chart that is visible at the
time you click Export Model. If you change the visible system or chart while
the Report Explorer Web view export pane is visible, the Report Explorer
5-5
5Export Simulink®Models to Web Views
pane does not automatically change to show information about the newly
visible system. To update the Report Explorer pane, click Refresh.
The Web view export dialog box or the Report Explorer displays a list of
layers — that is, Simulink systems or Stateflow charts—to export. The list of
layers depends on the export options you specify, as described in “Set Export
Options” on page 5-3.
To generate a Web view of all layers in the model, click OK in the Web View
dialog box, or click Export Model in the Report Explorer pane. This action
generates two sets of files in the current MATLAB folder:
An HTML file to appear in a Web browser.
A folder with the same name as the HTML file. This folder contains
supporting files, such as svg and png files.
To send the Web view to another computer, include both the HTML file and
the folder of supporting files. Package these items into a zip file for transfer.
When you generate a Web view, it appears in a Web browser by default. You
can suppress the display by setting the 'ViewFile' option to false.
5-6
Navigate Web Views
Navigate Web Views
In this section...
“Display Web Views” on page 5-7
“View the Current Layer” on page 5-7
“View Layers Below the Top Layer” on page 5-8
“View All Layers” on page 5-9
Display Web Views
To display Web views, you need a Web browser with support for Scalable
Vector Graphics (SVG), implemented natively or through a plug-in. For
detailed information on software requirements and limitations for using Web
views, see the Simulink Report Generator Release Notes.
A Web view display consists of:
A graphical display of the current layer (Simulink system or Stateflow
chart)
A hierarchical treeview browser for easy navigation through layers
Four navigation buttons at top left
Menu of navigation commands, which appears when you move the mouse
over the leftmost button
Shortcut menu, which appears in some browsers when you right-click the
current layer
View the Current Layer
Display an example Web view of the Simulink Automatic Climate Control
System model by typing the following commands at the MATLAB command
prompt:
sldemo_auto_climatecontrol;
slwebview(gcs)
5-7
5Export Simulink®Models to Web Views
As you move the mouse over the current layer, parameter names and
values appear for each system, chart, block, and line. Use the mouse, menu
commands, keyboard accelerators, and the arrow keys on your keyboard to
pan and zoom within the current layer.
Action
Navigation
Menu
Command
Shortcut Menu
Command
Keyboard
Accelerator
Zoom in Zoom in Zoom in R
Zoom out Zoom out Zoom out V
Zoom to normal
size (100%)
Zoom to 100% None 1
Zoom to largest
size that fits in
browser window
Zoom to full
screen
Zoom to full
screen
F
Pan up Pan up E
Pan down Pan down C
Pan left Pan left D
Pan right Pan right G
Pan with mouse
(drag layer while
in panning mode)
Pan with
mouse (click
to toggle panning
mode)
Pan with
mouse (click
to toggle panning
mode)
P,Q,or
SPACEBAR
(press to enter
panning mode;
releasetoexit
panning mode)
Note The shortcut menu command Find text searches for a text string in
the current layer. This command is only available in the Microsoft Internet
Explorer Web browser.
View Layers Below the Top Layer
Click a particular layer’s subsystem or subchart to make it the current layer.
The current layer is also selected in the treeview browser, and its subsystems
5-8
Navigate Web Views
or subcharts appear in the treeview browser hierarchically.Ifblocksinyour
current layer are linked to libraries, the Web view shows to which libraries
they belong.
Note If your current layer has no subsystems or subcharts, it does not
appear in the treeview browser.
As you move the mouse over an exported subsystem or subchart, it is
highlighted or the cursor changes, depending on which Web browser you are
using. You also see the following visual cues that enable you to assess your
location in the model quickly:
The subsystem or subchart’s corresponding icon in the treeview browser is
also highlighted, showing to where in the hierarchy you have navigated.
The names of the subsystem or subchart’s parent systems are grayed out
and italicized in the treeview browser.
You can use the navigation buttons at the top left to view other layers.
Action Navigation Button
View the previous layer in the view
history
View previous
View the top-level layer View home
View all layers in one window View all layers
View All Layers
Click the View all layers navigation button to view all layers in one window.
The layers appear in the Web browser as thumbnail images. You can click
a given layer to view details about it. Clicking the View all layers button
again returns to the previous view.
5-9
5Export Simulink®Models to Web Views
Tip You can also view all layers by selecting the Show all layers command
on the navigation and shortcut menus, and by using the Xkeyboard
accelerator.
5-10
Create Web Views of Simulink®Models
Create Web Views of Simulink Models
In this section...
“About This Tutorial” on page 5-11
“Specify Web View Export Options” on page 5-11
“Export Models” on page 5-13
“Navigate Web Views” on page 5-14
About This Tutorial
This tutorial takes you through the steps required to export a Simulink model
to a Web view. If you have a detailed model of your own, you can use it for
this example. Otherwise, use the example provided in this section.
There are several ways to create a Simulink model Web view. This
tutorial creates a Web view from the Simulink model window using the
sldemo_auto_climatecontrol model, which is provided with the Simulink
software. This model simulates the working of an automatic climate control
system in a car.
You do not need to know the Simulink product to follow this tutorial.
Specify Web View Export Options
Before creating the Web view, specify export options:
1Start a MATLAB software session.
2At the command prompt, enter sldemo_auto_climatecontrol to open
the Simulink model.
3Click File > Export > Export Model to Web.
A Web view window that includes data about the current model appears.
5-11
5Export Simulink®Models to Web Views
4In the Include systems selection list, select All to export all systems in
this model.
5In the Look under masks selection list, select Masks with no workspace
and no dialog to export only graphically masked blocks.
6Leave the Follow library links and Follow model reference blocks
check boxes cleared.
Exported Layers appears in the lower part of the Web View window. This
area lists the names of the systems to export to the Web view, along with their
Simulink paths. Because you selected All in the Include systems selection
list, all layers in the sldemo_auto_climatecontrol model appear.
5-12
Create Web Views of Simulink®Models
Export Models
To export the model to a Web view, click OK in the Web View window.
Note Scalable Vector Graphics (SVG) is required for Web views. The screen
shotsinthist
utorial use Microsoft Internet Explorer Web browser with the
SVG plug-in installed. Mozilla®Firefox®has native support for SVG. For
details on SVG, see “Browser Requirements for Web Views” on page 1-21.
If you do not have an SVG plug-in installed, then a dialog box appears with
instructions for installing an SVG plug-in. Complete the installation and
click OK in the Web View window.
The Web view of the model appears in the browser window.
5-13
5Export Simulink®Models to Web Views
Navigate Web Views
You can navigate Web views in ways similar to how you navigate models in
the Simulink GUI. The following steps help you experiment with the types of
navigation that are available.
1Notice the four navigation icons in the upper-left corner of the browser
window.
Navigation
commands
View
home
View
previous
Show all
layers
2Hover over the Navigation Commands icon to see a list of keyboard
shortcuts that allow you to move around the current window.
5-14
Create Web Views of Simulink®Models
3Press some of the keyboard keys listed here to see how the model in the
Web view reacts.
4Hover over the Temperature Control Chart diagram.
5-15
5Export Simulink®Models to Web Views
The name next to the navigation icons becomes Temperature Control
Chart.
5HoverovertheSystemTriggerblock.
The name next to the navigation icons changes to System Trigger.
In addition, the block parameter values for the System Trigger block
appear.
5-16
Create Web Views of Simulink®Models
6Hover over other blocks and subsystems in the model and observe the
results.
7Click the Temperature Control Chart.
The details of this Stateflow chart appear, and the middle two navigation
icons are now enabled:
The View Home icon takes you up to the top level of the model.
The View Previous icon takes you back to the previously displayed
level in the model.
5-17
5Export Simulink®Models to Web Views
8Click the setpoint_calc box in the Stateflow chart to see the details of
that block.
5-18
Create Web Views of Simulink®Models
9Click the View home icon to return to the model’s top layer.
10 Click the Show all layers icon. An overall view of the model appears.
5-19
5Export Simulink®Models to Web Views
This high-level view of the model shows all layers of the model. In this
figure, the arrow is hovering over the AC Control layer.
Try opening other Simulink models and exporting them to Web views, and
experiment with the results.
5-20
Troubleshooting Web Views
Troubleshooting Web Views
Web View Display Issues
Exporting a Simulink model to a Web view may produce the following error:
[Thu Aug 23 15:20:04 2007] [alert] [client 127.0.0.1]
/webserver/mydir/simulink_model_slwebview_files/.htaccess:
IndexIgnore not allowed here
This results in your Web browser failing to display the Web view.
This issue occurs because of settings specified in the .htaccess file in your
Web browser’s root folder. This file contains the Apache Web Server settings
for your Web server host. To fix this problem, delete this file or remove the
IndexIgnore * line from it.
5-21
5Export Simulink®Models to Web Views
5-22
6
Add Content with
Components
“Components” on page 6-2
“Report Structure Components” on page 6-4
“Table Formatting Components” on page 6-5
“Property Table Components” on page 6-6
“Summary Table Components” on page 6-17
“Dynamic Reporting Components” on page 6-22
6Add Content with Components
Components
Components are MATLAB objects that specify the content of a report. Add
components to specify the types of content that commonly occur in reports.
The MATLAB Report Generator provides a set of components for specifying
the types of content that commonly occur in MATLAB-based reports. The
Simulink Report Generator provides additional components to facilitate
generation of reports from Simulink models. You can also create custom
components to handle content specifictoyourapplication.
Using the Report Explorer, you can interactively combine components to
create a report setup that specifies the content of a particular report or type of
report. For general information about working with components, see:
“Insert Components”
“Set Component Properties”
Use a combination of the following types of components in your report setup
file, based on your goals for the report.
Type of Component Description
“Report Structure Components” on
page 6-4
Include a title page, chapters,
sections, paragraphs, lists, tables,
and other standard document
structure elements.
“Table Formatting Components” on
page 6-5
Organize generated content into
tables.
“Property Table Components” on
page 6-6
Display tables with property
name/property value pairs for
objects.
“Summary Table Components” on
page 6-17
Display tables with specified
properties for objects.
“Dynamic Reporting Components”
on page 6-22
Run child components a specified
number of times. There are several
looping components, including
logical loops and Handle Graphics
loops.
6-2
Components
Control Format with Stylesheets
When you generate a report, a stylesheet formats the content specified by
these componentstoreflectthedocumentorganization. For example, a report
stylesheet typically uses different font sizes for chapter titles and section
titles.
In the report setup, specify the stylesheet to use to format your report . You
can change the format of your report by modifying the specified stylesheet
or selecting another stylesheet. For details, see “Report Output Format and
Stylesheet”.
Control FormatattheComponentLevel
The output format and the stylesheet that you select for a report determines
most aspects of the formatting of the generated report. For details, see
“Report Output Format and Stylesheet”.
Several components include properties that you can set to specify formatting
details for that specific instance of a component. For example, for the MATLAB
Property Table, you can specify formatting such as whether to display table
borders or the alignment of text in table cells.
6-3
6Add Content with Components
Report Structure Components
Use report structure components to organize the content of your report into
chapters, sections, paragraphs, lists, tables, and other standard document
structure elements. The following table summarizes the report structure
components.
Component Usage
Title Page Generate a title page for a report.
Chapter/SubsectionParent components that generate the content of a
chapter or chapter subsection.
Paragraph Specify the content and text format of a paragraph
of text. Can serve as the parent of one or more text
components, enabling use of multiple text formats (for
example, bold, regular, or italic) in the same paragraph.
Text Format strings of generated text.
List Generate a list from a cell array of numbers or
strings or parent components (for example, Paragraph
components) that specify the items in a list. You can
create multilevel lists by embedding list components
within list components.
Link Generate a hyperlink from one location in a report to
another or to an external location on the user’s file
system or the Worldwide Web.
Image Insert an image into a report.
Array-Based
Table
Generate a table from a cell array of numbers or strings.
Table Parent a table body component. See “Table Formatting
Components”.
6-4
Table Formatting Components
Table Formatting Components
Use table formatting components to organize generated content into tables.
The following table summarizes the table formatting components.
Component Usage
Table Parent a table body component. Can also parent
column specification components and a table header
and a table footer component. Specifies properties of
thetableasawhole(forexample,itstitle,number
of columns, and border).
Table Body Parent the rows that make up the table body.
Specifies the default vertical alignment of entries
in a table body.
Table Column
Specification
Specify attributes of a table column, such as its
width and borders and the default horizontal
alignment of column entries.
Table Entry Parent a component that determines a table entry’s
content, such as a paragraph, image, list, or another
table component. Specifies attributes of a table
entry, such as the number of rows and columns that
it spans.
Table Footer Parent the row components that generate the
content of a table footer.
Table Header Parent the row components that generate the
content of a table header.
Table Row Parent the table entry components that generate
the content of a table row.
TipInserting a Table component into a setup also inserts all the descendant
components required to generate a 2x2 table, creating a table template. Edit
this template to create a table that suits your needs.
6-5
6Add Content with Components
Property Table Components
In this section...
“About Property Table Components” on page 6-6
“Open the Example Report Template” on page 6-8
“Examine the Property Table Output” on page 6-8
SelectObjectTypes”onpage6-9
“Display Property Name/Property Value Pairs” on page 6-9
“Edit Table Titles” on page 6-12
“Enter Text into Table Cells” on page 6-12
“Add, Replace, and Delete Properties in Tables” on page 6-13
“Format Table Columns, Rows, and Cells” on page 6-14
“Zoom and Scroll” on page 6-16
“Select a Table” on page 6-16
About Property Table Components
Property Table components display property name/property value pairs for
objects in tables. The following example shows a property table from the
figloop-tutorial report.
6-6
Property Table Components
Many types of property table components are available, including:
MATLAB Property Table
Simulink Property Table (requires Simulink Report Generator)
Stateflow Property Table (requires Simulink Report Generator)
The component used in this example represents MATLAB Report Generator
property table components, all of which exhibit similar behavior.
6-7
6Add Content with Components
Open the Example Report Template
This example usesthefigloop-tutorial report template. To open the figure
loop tutorial report template, at the MATLAB command line enter:
setedit figloop-tutorial
Examine the Property Table Output
Property pages for all property table components are similar in form. In the
Outline pane,selecttheFigure Prop Table component. To modify table
settings, in the Handle Graphics Property Table dialog box, click the Edit...
button.
6-8
Property Table Components
Select Object Types
Property table components offer multiple object types on which to report. For
example, the Handle Graphics Property Table lets you report on a figure, an
axes object, or a Handle Graphics object.
You can select a different object type on which to report in the Object type
list in the Propertiespaneforthecomponent.
Display Property Name/Property Value Pairs
Split Property/Value Cells
1InthePropertiespanefortheHandleGraphics Property Table component,
clear the Split property/value cells check box.
2Click Edit.Thetableisnowinnonsplit mode. Nonsplit mode supports
more than one property name/property value pair per cell and text.
6-9
6Add Content with Components
3For the property name and property value to appear in adjacent horizontal
cells in the table, select the Split property/value cells check box.
The table is now in split mode. Split mode supports only one property
name/property value pair per cell. If more than one property pair appears
in a cell, only the first pair appears in the report; all subsequent pairs
are ignored.
Display Options
Property name/property value pairs can appear in cells in several ways. To
specify how a given property name/property value pair appears in a cell, select
that field in the table (for this tutorial, select the Name property). Choose
Valuefrom the display options drop-down list at the bottom of the dialog box.
In the selected table row, only the value appears.
6-10
Property Table Components
Format Options
To specify alignment for text in a given cell, in the toolbar at the bottom of
the dialog box use the four justification buttons.
Select the HandleVisibility table row. Then select the double-justify button
(the last button to the right).
6-11
6Add Content with Components
Edit Table Titles
Table titles can contain properties and text. By default, the title of a table is
thesameasthevalueofthe%<Name> property. You can modify this property
to modify the table title.
Note Table titles are always in nonsplit mode.
Enter Text into Table Cells
For the text to be visible, the table must be in nonsplit mode. Clear Split
property/value cells.
To enter text into the HandleVisibility table cell, double-click the cell. A
gray box appears with the label for the cell property.
6-12
Property Table Components
Ifyoutypetextoutsidetheanglebrackets,thetextappearsasisinthe
report. Text inside the table brackets must specify a valid property name. If
you enter an invalid property name, the property name appears in the report
without a property value.
Add, Replace, and Delete Properties in Tables
Adding Table Properties
To add a Handle Graphics property to a table, use the following steps.
1In the Figure Property Table window, select a table row above which you
want add a new property.
2Click the Add Row Above Current Cell button
A new row appears above the current row.
6-13
6Add Content with Components
3Add the property to the new table row.
aSelect the new table row.
bIn the Properties Type drop-down list at the upper-right of the dialog
box, select a property type.
cIn the Properties list, select the property you want to add.
dClick the << Add button, or double-click the property name. The
property appears in the table row.
Alternatively, if you know the name of the property you want to add, enter
thepropertynamedirectlyintothecell as described in “Enter Text into
Table Cells”. For information about adding new table rows, see “Add and
Delete Columns and Rows”.
Replace Table Properties
To replace a property in a cell of a table in split mode, follow the instructions
in “Adding Table Properties” on page 6-13.
Note You cannot use these steps to delete a property in a cell when the
table is in nonsplit mode.
Delete Table Properties
Delete a property by backspacing over it or using the Delete key.
Format Table Columns, Rows, and Cells
Add and Delete Columns and Rows
To add or delete a column or row, select a cell and then click one of the buttons
described in the following table.
Note You cannot delete a row or column when it is the only row or column
in the table.
6-14
Property Table Components
Button Action
Addcolumn(addedtotheleftoftheselected
column)
Delete selected column
Add row (added above the selected row)
Delete selected row
Resize Columns
To resize the width of a column, click and drag its vertical borders as needed.
Merge and Split Cells
To merge or split table cells, select a row and then click one of the buttons
described in the following table.
Button Action
Merge cells downward
Merge cells to the right
Split cells
Display or Hide Cell Borders
To toggle cell borders on and off:
1Place your cursor in a cell and right-click to invoke its context menu.
6-15
6Add Content with Components
2Choose Cell borders > Top,Bottom,Right,orLeft to toggle the
specified border on or off.
Zoom and Scroll
You can zoom in and out of the table with the zoom buttons, which are located
to the left of the horizontal scroll bar.
Button Action
Zoom in
Zoom out
You can scroll vertically and horizontally using the table scroll bars.
Select a Table
To display property name/property value pairs, you can select a preset table
or use a custom table.
A preset table is built-in and formatted. You can select a preset table in the
preset table selection list in the upper-left of the Figure Prop Table window.
To apply a preset table, select the table and click Apply.
To create a custom table, select a preset table and modify it to fit your
needs by adding and/or deleting rows and properties. You may want to
start with the Blank 4x4 preset table.
Note You cannot save a custom table as a preset table. If you do so, you
lose all changes to the custom table.
6-16
Summary Table Components
Summary Table Components
In this section...
“About Summary Table Components” on page 6-17
“Open the Example Report Template” on page 6-19
“Select Object Types” on page 6-19
“Add and Remove Properties” on page 6-19
“Set Relative Column Widths” on page 6-20
“Set Object Row Options” on page 6-20
About Summary Table Components
Summary table components insert tables that include specified properties for
objects into generated reports. Summary tables contain one object per row,
with each object property appearing in a column, as shown in the following
summary table in the figloop-tutorial report.
6-17