Mathworks MATLAB REPORT GENERATOR 3 user guide

MATLAB®Report Generator™ 3
User’s Guide
How to Contact The MathWorks
www.mathworks. comp.soft-sys.matlab Newsgroup www.mathworks.com/contact_TS.html T echnical Support
suggest@mathworks.com Product enhancement suggestions
bugs@mathwo doc@mathworks.com Documentation error reports service@mathworks.com Order status, license renewals, passcodes
info@mathwo
com
rks.com
rks.com
Web
Bug reports
Sales, prici
ng, 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.
®
MATLAB
© COPYRIGHT 1999–2010 by The MathWorks, Inc.
The software described in this document is furnished under a license agreem ent. 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 MathW orks, 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 term s 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 en tity 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 Docu mentation, 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. O ther product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Report Generator™ User’s Guide
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 V ersion 3.2.1 (Release 2007b) This publication
was previously for MATLAB MATLAB
®
only.
®
and Simulink®.Itisnowfor
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)
User’s Guide
Getting Started
1
Product Overview ................................. 1-2
Contents
What Is the Report Explorer?
About the Report Explorer The Outline Pane The Options Pane The Properties Pane
MATLAB
How MATLAB
Software Interact
Supported Report Formats
®
Report Generator Workflow .............. 1-8
................................. 1-5
................................. 1-6
............................... 1-7
®
Report Generator and MATLAB
................................ 1-9
....................... 1-3
.......................... 1-3
......................... 1-10
Examples
Generating Reports from MATLAB Files ............. 2
Working with Components
......................... 2
Customizing Components
.......................... 2
v
Customizing Stylesheets ........................... 2
Generating Reports from X ML files
................. 2
Creating MATLAB Reports
2
About This Tutorial ................................ 2-2
Setting Report Options in the Report Template
Adding Components to the Report Template
About Components Setting Initial Values Creating a Title Page Adding the First Chapter Adding Components to the First Chapter Creating the Magic Squares and Their Images
Generating the Report
................................ 2-5
.............................. 2-7
.............................. 2-10
........................... 2-13
.............. 2-14
............................. 2-38
...... 2-3
......... 2-5
.......... 2-21
vi Contents
Generating Reports
3
Setting Report Output Options ..................... 3-2
Setting Preferences Setting the Report File Folder Setting the Report File Name Setting the Report Format Viewing and Printing Reports Converting English Strings to Other Languages Autosaving Report Templates Reporting Compiled Simulink Model Data Regenerating Images Including a Report Description
................................ 3-2
....................... 3-3
........................ 3-4
.......................... 3-4
....................... 3-8
........ 3-9
....................... 3-9
............. 3-9
.............................. 3-10
...................... 3-10
Converting XML Documents ........................ 3-11
Why Convert XML Documents? Converting XML Documents Using the Report Explorer Converting XML Documents Using the Command Line Editing XML Source Files
...................... 3-11
.. 3-11 .. 3-13
........................... 3-13
Creating Log Files
Generating MATLAB Code from Report Templates
Working with Legacy Report Templates
What Are Legacy Report Templates? Enabling Legacy Interfaces UsingLegacyInterfaces
Troubleshooting
Managing Memory Usage Displaying HTML Reports on UNIX Systems
................................. 3-14
............. 3-18
.................. 3-18
......................... 3-18
............................ 3-19
................................... 3-20
........................... 3-20
........... 3-21
Working with C omponents
4
About Components ................................ 4-2
Working with Looping Components
About Looping Components Editing the Figure Loop Tutorial Report Template Displaying Figure s Editing Figure Loop Components
................................ 4-4
......................... 4-3
................. 4-3
...... 4-3
.................... 4-4
... 3-15
Working with Property Table Components
About Property Table Components Opening the Example Report Template Examining the Property Table Output Selecting Object Types Displaying Property Name/Property Value Pairs Editing Table Titles Entering Text into Table Cells
............................. 4-12
............................... 4-15
................... 4-9
............... 4-11
................ 4-11
....................... 4-15
........... 4-9
........ 4-12
vii
Adding, Replacing, and Deleting Properties in Tables .... 4-16
Displaying or Hiding Cell Borders Adding and Deleting Columns and Rows Resizing Columns Merging and Splitting Cells Zooming and Scrolling Selecting Tables
................................. 4-18
............................. 4-19
.................................. 4-19
.................... 4-17
.............. 4-18
......................... 4-18
Working with Summary Table Components
About Summary Table Components Opening the Example Report Template Selecting Object Types Adding and Removing Properties Setting Relative Column Widths Setting Object Row Options
............................. 4-23
......................... 4-24
.................. 4-21
..................... 4-23
..................... 4-24
.......... 4-21
............... 4-23
Creating Custom Components
5
About Custom Components ......................... 5-2
Component Creation Proc e ss
Defining Components
Required Component Data Specifying the LocationofComponentFiles SettingComponentDisplayOptions Specifying Component Properties Modifying Existing Components Building Components Rebuilding Existing Components Removing a Component
.............................. 5-6
.............................. 5-12
....................... 5-3
.......................... 5-6
............ 5-6
.................. 5-7
.................... 5-9
..................... 5-12
..................... 5-13
............................ 5-13
viii Contents
Defining Component Tasks
About Component Customization Required Customization: Specifying Format and Content of
Report Output
Changing a Component’s Outline String in the Report
Explorer Hierarchy
.................................. 5-15
......................... 5-14
.................... 5-14
.............................. 5-17
Modifying the Appearance of Properties Dialog Boxes .... 5-18
Specifying Additional Component Properties
........... 5-18
Examples
Fetching Securities Data and Displaying It in a Table Displaying Securities Data in Two Tables
......................................... 5-21
.............. 5-26
Creating Custom Stylesheets
6
About Stylesheets .................................. 6-2
Built-In Versus Custom Stylesheets Customizing Stylesheets Using Data Items
Working with Stylesheets
Using the Report Explorer to Edit Stylesheets Creating New Stylesheets Saving Stylesheets Deleting Stylesheets
Editing Stylesheet Data Items
Categories of Data Items in Built-In Stylesheets Editing Data Items in Simple Versus Advanced Edit
Mode
Working with Data Items
......................................... 6-14
................................ 6-8
.......................... 6-5
.......................... 6-8
............................... 6-9
........................... 6-15
.................. 6-2
............ 6-3
.......... 6-5
...................... 6-10
........ 6-10
... 5-21
Using Stylesheet Cells to Manage PDF Report Header
and Footer Content
About Styleshee t Cells and Cell Groups Working with Headers and Footers Using Templates to Add Content to Headers and
Footers Inserting Graphics Files Modifying Fonts and Other Properties
Examples
Numbering Pag es in a Report Adding Graphics to Headers in PDF Reports
........................................ 6-25
......................................... 6-28
.............................. 6-22
............... 6-22
................... 6-23
............................ 6-26
................ 6-27
....................... 6-28
........... 6-29
ix
Changing Font Size, Page Orientation, and Paper Type of a
Generated R eport
Editing Font Size as a Derived V alue in XML
............................... 6-34
.......... 6-37
Comparing XML Files
7
How to Compare XML Files ......................... 7-2
Introduction Selecting Files to Compare XML Comparison Demos See Also
...................................... 7-2
.......................... 7-3
........................... 7-4
......................................... 7-4
Using the XML Com parison Report
Navigating the XML Com p a riso n Report Saving Comparison Files in a Zip File
Known Limitations and Workarounds
Unexpected Re sults Setting File and Memory Sizes Errors from UNC Paths Resolving C os metic Issues with the HTML Browser
How T he Matching Algorithm Works
WhyDoISeeUnexpectedResults? How the Chawathe Algorithm Works Why Us e a Heuristic Algorithm? Examples of Unexpected Re sults
................................ 7-9
............................ 7-10
.................. 7-6
.............. 7-6
................. 7-7
............... 7-9
....................... 7-9
................ 7-11
................... 7-11
................. 7-11
..................... 7-13
..................... 7-13
Component Reference
8
Formatting Components ........................... 8-2
..... 7-10
x Contents
Handle Graphics Components
...................... 8-4
Logical and Flow Components ...................... 8-6
9
10
MATLAB Components
MATLAB
®
Report Generator Components ............ 8-8
.............................. 8-7
Components — Alphabetical List
Function Reference
Customization ..................................... 10-2
GUI
Report Formatting
.............................................. 10-3
................................. 10-4
11
A
Report Generation
................................. 10-5
Functions – Alphabetical List
Examples
Generating Reports from MATLAB Files ............. A-2
xi
Working with Components ......................... A-2
Customizing Components
Customizing Stylesheets
Generating Reports from X ML files
.......................... A-2
........................... A-2
................. A-2
Index
xii Contents
User’s Guide
Chapter 1, Getting Started (p. 1-1) Overview of MATLAB®Report
Generator™ tasks, workflow, and interaction with the MATLAB software
_
®
Chapter 2, Creating MATLAB Reports (p. 2-1)
Chapter 3, Generating Reports (p. 3-1)
Chapter 4, Working with Components (p. 4-1)
Chapter 5, Creating Custom Components (p. 5-1)
Chapter 6, Creating Custom Stylesheets (p. 6-1)
Chapter 7, Comparing XML Files (p. 7-1)
endix A, Examples (p. A-1)
App
A step-by-step example that creates a MATLAB report
How to format and generate reports
Examples of building report templates with various components
How to create custom components and edit generated files
Explai format
Intro descr comp resu
ns how to customize ting and display of documents
duces XML comparison, and
ibes how to select files to
are, and understand the
lting report.

Getting Started

“Product Overview” on page 1-2
“What Is the Report Explorer?” on page 1-3
®
“MATLAB
“How MATLAB
page 1-9
“Supported Report Formats” on page 1-10
Report Generator Workflow” on page 1-8
®
Report Generator and MATLAB Software Interact” on
1
1 Getting Started

Product Overview

You can use the MATLAB Report Generator software to:
Document MATLAB software tasks, such as analyzing and visualizing data
Create a reusable report template that reflects your own styles and
Keep your documentation and specifications up to date with your workflow
Create user manuals that accurately capture your application capabilities
Create comparison reports for XML files. See Chapter 7, “Comparing
The report generation process creates documentation (called reports) about MATLAB data and w orkflow. You can customize report templates to include:
and developing algorithms
standards
and specifications
XML Files”.
1-2
MATLAB code and its output
Workspace data
MATLAB graphics
Logical components like
report generation
Loops that perform a series of operations on multiple objects
User-defined text, styles, and components
IF, THEN, ELSE,andWHILE that allow conditional

What Is the Report Explorer?

In this section...
“About the Report Explorer” on page 1-3
“The Outline Pane” on page 1-5
“The Options P ane ” on page 1-6
“The Properties Pane” on page 1-7

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 templates.
Apply stylesheets to format the generated report.
Specify the report file format.
What Is the Report Explorer?
Generate reports.
To open the Report Explorer, enter Window.
report in the MATLAB Comm and
1-3
1 Getting Started
Report Generator Help Menu
1-4
Properties paneOutline pane Options pane
The Report Explorer has three panes:
The Outline pane on the left shows the hierarchy of components in currently
opened report templates. Report components can reside within other report components, creating parent, child, and sibling relationships. For more information, see “The Outline Pane” on page 1-5.
What Is the Report Explorer?
The Options pane inthemiddleliststheoptionsavailableinthecontext
of the Outline pane. If no report template is open, the Options pane lists available reports. When a report template is open, the Options pane lists components available to insert into it. When a stylesheet is open, the Options pane lists available attributes. For more information, see “The Options Pane” on page 1-6 .
If no report template is open, the Properties pane on the right displays
tasks the Report Explorer can perform. If a report template is open, the Properties pane displays the properties for the item that is currently selected in the Options pane. For more information, see “The Properties Pane” on page 1-7.
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.

The Outline Pane

The Outline pane initially contains the top level of the report template.
1-5
1 Getting Started

The Options Pane

The Options pane report template
Formatting, Ha
For details abo
lists by category components that are available for adding to
s. In the following figure, the visible component categories are
ndle Graphics
ut report components, see Chapter 8, “Component Reference”.
, Logical and Flow Control,andMATLAB.
The folder ico acomponent.
n indicates a component category. The blue square icon indicates
1-6
What Is the Report Explorer?
The Properties P
After you create properties for t
a report tem plate , the Properties pane initially displays
he report template as a whole.
ane
1-7
1 Getting Started

MATLAB Report Generator Workflow

1 Open the Report Explorer.
2 Create a report template. For details about report templates, see Chapter
2, “Creating MATLAB Reports” in this documentation.
3 Add e xisting components to the report template or create your own custom
components. For details on using components, see Chapter 4, “Working with Components” in this documentation.
4 Choose an existing stylesheet or create a custom stylesheet to apply styles
and standards to the report. For details on stylesheets and attributes, see Chapter 6, “Creating Custom Stylesheets” in this documentation.
5 Generate the report.
The following figure illustrates a typical MATLAB Report Generator workflow.
1-8
Generate
M-code
Open
Report
Explorer
(GUI)
Report Generator
Create
setup
file
components
Add
Apply
stylesheet
Generate
report
How MATLAB®Report Generator™ and MATLAB®Software Interact

How MATLAB Report Generator and MATLAB Software Interact

The MATLAB Report Generator and MATLAB software interact to create reports. You can access the Report Explorer GUI from the MA TLAB command line.
The following table describes these interactions in detail.
User Interface
Report Explorer
MATLAB command line
MATLAB Report Generator Interaction Description
The Report Explorer is the MATLAB Report Generator graphical user interface (GUI). For more information, see “What Is the Report Explorer?” on page 1-3.
Enter commands at the MATLAB command line to:
Start the Report Explorer
Create and modify report template
files
Apply stylesheets
Specify output formats for reports
Generate reports
Use the Report Explorer to edit existing report templates, components, stylesheets, and attributes , or to customize your own.
The following MATLAB commands work with the MATLAB Report Generator software:
report — Start the Report Explorer.
setedit — Edit a report template
with the Report Explorer.
rptconvert — Convert a source file
created by the report-generation process to the desired output format.
rptlist —List.rpt files in the
current path.
1-9
1 Getting Started

Supported Report Formats

When the report-generation proce ss first creates a report, it generates a DocBook XML source file. You can customize this XM L as needed. For more information on how to customize DocBook XML, see the OASIS DocBook TC Web page at
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
Adobe
Note PDF reports only support bitmap (.bmp)andjpeg(.jpg)images.
http://www.oasis-open.org.
®
Word (.doc)
®
Acrobat®PDF
1-10

Examples

Use this list to find examples in the documentation.
_
Examples

Generating Repor ts from MATLAB Files

Generating Reports from MATLAB®Files on page 3-15

Working with Components

“Working with Looping Components” on page 4-3 “Working with Property Table Components” on page 4-9 “Working with Summary Table Components” on page 4-21

Customizing Components

“Fetching Securities Data and Displaying It in a Table” on page 5-21 “Displaying Securities Data in Two Tables” on page 5-26

Customizing Stylesheets

“Numbering Pages in a Report” on page 6-28 “Adding Graphics to Headers in PDF Reports” on page 6-29 “Changing Font Size, Page Orientation, and Paper Type of a Generate d
Report” on page 6-34 “Editing Font Size as a Derived Value in XML” on page 6-37

Generating Reports from XML files

“How to Compare XML Files” on page 7-2
Examples-2
2

Creating MATLAB Reports

“About This Tutorial” on page 2-2
“Setting Report Options in the Report Template” on page 2-3
“Adding Components to the Report Template” on page 2-5
“Generating the Report” on page 2-38
2 Creating MATLAB
®
Reports

About This Tutorial

Tasks dem onstrated in this tutorial include the following:
Evaluating MATLAB expressions
Formatting reports with multiple chapters
Running loops and flow control
Handling errors
Inserting workspace data
Inserting MATLAB images
This tutorial takes you through the steps required to design a report template file and generate a report from it in the MATLAB software.
The report template that you design does the following:
2-2
1 Uses MATLAB code to create several magic squares – matrices whose
columns, rows, and diagonals all add up to the same number.
2 Displays the magic squares in the generated report as matrices or images,
depending on their size.
For more information on magic squares, see “Matrices and Magic Squares” in the MATLAB documentation.
Note You do not need to know the MATLAB software to use this tutorial. However, knowledge of MATLAB is helpful for understanding the MATLAB code that executes during report generation.

Setting Report Options in the Report Template

Setting Report Options in the Report Template
To create and configure a report template:
1 Start a MATLAB software session.
2 Open the Report Explorer by entering report at the MATLAB command
line.
3 Select File >
has the defau
4 In the Properties pane on the right:
a To save the report in the current working folder, select Present Working
Directory
b Set File format to web (HTML) to create the report as an HTML file.
c In the Report description text box, replace the existing text with the
New to create a report template. The new report template lt name
Unnamed.rpt.
from the Directory list.
following text.
Tip Copy and paste this text from the HTML documentation into the Report Explorer.
This report creates a series of magic squares and displays them as images.
A magic square is a matrix in which the columns, rows, and diagonal all add up to the same number.
Note
chan As s Rep whi
When you change a Properties pane field, its background color
ges. This indicates that there are unapplied changes to that field.
oon as you perform any action w ith another component, MATLAB
ort Generator applies the changes, and the background color becomes
te again.
2-3
2 Creating MATLAB
®
Reports
5 Save your report. Select File > Save As and name your report’s report
template
magic_squares.rpt.
The new file name appears in the Outline pane on the left.
2-4

Adding Components to the Report Template

Adding Components to the Report Template
In this section...
“About Components” on page 2-5
“Setting Initial Values” on page 2-7
“Creating a Title Page” on page 2-10
“Adding the First Chapter” on page 2-13
“Adding Components to the First Chapter” on page 2-14
“Creating the Magic Squares and Their Images” on page 2-21

About Components

Report components specify what information you want to include in the report. The following figure shows a sample page from the report you create in this tutorial and what components are used to produce it.
Note Report components added to the report template must not be deactivated in order for the report to generate correctly.
2-5
2 Creating MATLAB
Title Page
component
Chapter
component
®
Reports
2-6
Text
component
Text
component
Figure
Snapshot
component
Adding Components to the Report Template
Setting Initial
To specify the si MATLAB Expressi
1 In the Outline p
2 In the Optio
Evaluate MA
3 In the Properties pane on the right, click the icon next to Add component
Values
zes of the magic squares in the report, use the Evaluate
on component.
ane on the left, select the top level of the report template.
ns pane in the middle, under the
TLAB Expression
.
MATLAB category, select
to current report to insert it into the report.
YoucannoteditthecomponentinformationinthePropertiespaneuntil you have added the component to the report.
In the Outline pane on the left, the
magic_squares report.
Eval component appears under the
2-7
2 Creating MATLAB
®
Reports
The icon in the upper left corner of the Eval component indicates that this component cannot have child components. By default, any components you add with the
Eval component selected are siblings to this component.
The options for the
Evaluate MATLAB Expression component appear in
the Properties pane on the right.
2-8
4 Clear the Insert MATLAB expression in report and Display command
window output in report check boxes. You do not want to include the
MATLAB code details or its output in this report.
Adding Components to the Report Template
5 In the Expression to evaluate in the base workspace text box, replace
the existing text with the following MATLAB code.
Tip Copy and paste this text from the HTML documentation into the Report Explorer.
%This MATLAB code sets up two variables %that define how the report runs. %magicSizeVector is a list of MxM %Magic Square sizes to insert into %the report. Note that magic %squares cannot be 2x2.
magicSizeVector=[4 8 16 32];
%largestDisplayedArray sets the %limit of array size that will be %inserted into the report with the %Insert Variable component.
largestDisplayedArray=15;
6 In the Evaluate this expression if there is an error text box, replace
the existing text with the following text.
disp(['Error during eval: ', lasterr])
ThiscausesanerrortodisplayiftheMATLABcodefails.
Tip To execute these commands immediately, click the Eval Now button at the top right corner of the Report Explorer. This is an easy way to check if your commands are correct, and ensure that they will not cause report-generation problems.
7 Save the report by clicking File > Save.
2-9
2 Creating MATLAB
®
Reports
Creating a Title
To create a title
1 In the Outline p
2 In the Options pane in the middle, under the Formatting category,
double-click
page for the report, use the Title Page component.
Title Page to add the component to the report.
Page
ane on the left, select the
Eval component.
2-10
Because the Eval component’s icon indicates that this component cannot have children, the
Title Page component is a sibling of the Eval
component. Likewise, the Title Page component cannot have children either.
3 In the Properties pane on the right,
Adding Components to the Report Template
a In the Title text box, enter Magic Squares.
b In the Subtitle text box, enter Columns, Rows, Diagonals: Everyone
is Equal
c Under Options,chooseCustom author from the selection list.
d In the field to the right of the Custom author field, enter Albrecht
Durer
.
.
Albrecht Dürer created the etching that contains a magic square. Your final report includes an image of that etching.
e Select the Include cop yr igh t holder and yea r check box.
f In the next text box, enter The MathWorks.
g In the second text box, enter 1998.
2-11
2 Creating MATLAB
®
Reports
h Click the Abstract tab and then enter the following text:
An introduction to Magic Squares and their meaning.
The pane should look as follows:
2-12
4 Save the report.
Adding Components to the Report Template
Adding the First
Add a chapter to t
1 In the Outline p
2 In the Options pane in the middle, under the Formatting category,
double-click
he report by using the Chapte r/Subse ction component.
Chapter/Subsection.
Chapter
ane on the left, select the
Title Page component.
The Outline pane looks as follows.
The Eval, Title Page,andChapter components are all child components of the report’s top level, but siblings of one another.
The
Chapter component can have child components. The next section
explains how to add child components to this
3 In the Properties pane on the right, enter Magic Squares Explained for
Chapter component.
the custom chapter title.
The Outline pane on the left changes to reflect the chapter title.
2-13
2 Creating MATLAB
®
Reports
4 Save the report.

Adding Components to the First Chapter

Add introductory text to the first chapter using the Paragraph and Text components.
1 In the Outline pane on the left, select the Chapter component.
2 In the Options pane in the middle, under the Formatting category,
double-click
Paragraph.
2-14
In the Outline pane on the left, the new component appears as a child of the
Chapter component.
Adding Components to the Report Template
3 By default, the Paragraph component inherits its text from its child
components. Add two
Text components.
Note The Text componentmusthavetheParagraph component as its parent.
4 In the Options pane in the middle, under the Formatting category,
double-click
Text.
5 Double-click Text again to add a second component.
The Outline pane looks as follows.
6 In the Outline pane on the left, select the first Text component.
7 In the Text to include in report text box, enter %<help('magic')>.
2-15
2 Creating MATLAB
®
Reports
The % sign and angle brackets <> indicate to the MATLAB Report GeneratorsoftwarethatthisisMATLABcodetoevaluate. Thecommand
help('magic') displays information about the MATLAB magic function.
8 In the Outline pane on the left, select the second Text component.
9 In the Text to include in report text box, enter the following text.
Tip Copy and paste this text from the HTML documentation into the
Report Explorer.
The German artist Albrecht Durer (1471-1528) created many woodcuts and prints with religious and scientific symbolism. One of his most famous works, Melancholia I, explores the depressed state of mind that opposes inspiration and expression. Renaissance astrologers believed that the Jupiter magic square (shown in the upper right portion of the image) could aid in the cure of melancholy. The engraving's date (1514) can be found in the lower row of numbers in the square.
2-16
10 Save the report.
The next step includes an image of the etching shown at the beginning of this section.
11 In the Outline pane on the left, select the Chapter component.
12 In the Options pane in the middle, under the MATLAB category, double-click
Evaluate MATLAB Expression.
The new component becomes a child of the
Chapter component.
Adding Components to the Report Template
Move the Eval component under the Paragraph componentsothatthe image follows the introductory text.
13 Click the down arrow on the toolbar to move the Eval component under
the
Paragraph component.
14 With the Eval component still s ele cted, do the followin g in the Properties
pane on the right:
a Clear the Insert M AT LAB expression in report and Display
command window output in report check boxes. You do not want
to include the code or its output in the report.
2-17
2 Creating MATLAB
®
Reports
b In the Expression to evaluate in the base workspace text box,
replace the existing text with the following MATLAB code.
Tip Copy and paste this text from the HTML documentation into the Report Explorer.
%This loads a self-portrait of Albrecht
%Durer, a German artist. There is a
%magic square in the upper right corner
%of the image.
durerData=load('durer.mat','-mat');
figure('Units','Pixels',...
'Position',[200 200 size(durerData.X,2)*.5 size(durerData.X,1)*.5 ]);
image(durerData.X);
colormap(durerData.map);
axis('image');
set(gca,...
'Xtick',[],...
'Ytick',[],...
'Units','normal',...
'Position',[0 0 1 1]);
2-18
clear durerData
This MATLAB code displays the Dürer etching in a MATLAB figure window.
c In the Evaluate expression if there is an error text box, r eplace th e
existing text with thefollowingtext:
disp(['Error during eval: ', lasterr])
This code executes if an error occurs while loading the Dürer etching.
The Properties pane on the right looks as follows.
Adding Components to the Report Template
Now that the image of the Dürer etching appears in the MATLAB workspace, include it in the report using the Figure Snapshot component.
15 In the Outline pane on the left, select the Eval component.
16 In th
doub
e Options pane in the middle, under the
le-click
Figure Snapshot.
Handle Graphics category,
2-19
2 Creating MATLAB
®
Reports
2-20
17 In the Properties pane on the right:
a In the Paper orientation list, select Portrait.
b In the Invert hardcopy list, select Don't invert.
ting this option specifies not to change the image’s on-screen colors
Selec
inting.
for pr
Delete the image after adding it to the report.
18 In the Outline pane on the left, select the Figure Snapshot component.
19 In t
20 In the Properties pane on the right:
he Options pane in the middle, under the
luate MATLAB Expression
Eva
.
MATLAB category, double-click
Adding Components to the Report Template
a Clear the Insert M AT LAB expression in report and Display
command window output in report check boxes. You do not want
to include the code or its output in the report.
b In the Expression to evaluate in the base workspace text box,
replace the existing text with the following text:
%This command deletes the Durer image delete(gcf);
The delete(gcf) command deletes the current image in the MATLAB workspace, in this case, the Dürer etching.
c In the Evaluate expression if there is an error text box, r eplace th e
existing text with thefollowingtext:
disp(['Error during eval: ', lasterr])
This code executes if an error occurs while deleting the Dürer etching.
21 Save the report.
The contents of the first chapter are now complete.

Creating the Magic Squares and Their Images

Use components to create several magic squares and insert the contents of the squares, or representative images, into the report.
Creating the For Loop
Each square has its own chapter. A For Loop component performs tasks for each square.
1 In the Outline pane on the left, select the Chapter component.
2 In the Options pane in the middle, under the Logical and Flow Control
category, double-click For Loop.
2-21
2 Creating MATLAB
®
Reports
The Outline pane on the left looks as follows.
2-22
This component appears inside the Chapter component. However, the magic squares should be processed after the first chapter, so the
for
component should be a sibling of the Chapter component, not a child.
3 In th
4 Click the left arrow to make the for component a sibling, not a child, of the
e Outline pane on the left, select the
Chapter component.
for component.
Adding Components to the Report Template
5 In the P rop
a In the End
This is t magic sq
b In the V
follow
This v
erties pane on the right:
text box, replace the existing text w ith the following text:
length(magicSizeVector)
he length of the vector that contains the various sizes for the
uare matrices.
ariable name text box, replace the existing text with the
ing text:
MAGIC_SQUARE_INDEX
ariable acts as a loop index.
The Outline pane on the left looks as follows.
2-23
2 Creating MATLAB
®
Reports
6 Save the re
port.
Adding a Chapter for Each Square
Add a chap compone
1 In the Ou
2 In the Options pane in the middle, under the Formatting category,
double-click
It becomes a child of the
3 In the
enter
The P
ter for each square processed using the Chapter/Subsection
nt.
tlinepaneontheleft,selectthe
Chapter/Subsection.
for component.
Properties pane on the right, select
for component.
Custom from the Title li st and
the following for the chapter title:
Magic Square # %<MAGIC_SQUARE_INDEX>
roperties pane looks as follows.
2-24
Adding Components to the Report Template
4 Save the report.
Determining the Matrix Size
Extract the size of each magic square matrix from magicSizeVector using an Evaluate MATLAB Expression component.
1 In the Outline pane on the left, select the Chapter component.
2 In the Options pane in the middle, under the MATLAB category, double-click
Evaluate MATLAB Expression.
2-25
2 Creating MATLAB
®
Reports
3 In the Properties pane on the right:
a Clear the Insert M AT LAB expression in report and Display
command window output in report check boxes.
b In the Expression to evaluate in the base workspace text box,
replace the existing text with the following text:
magic_Square_Size=magicSizeVector(MAGIC_SQUARE_INDEX);
This command extracts the next size for the magic square from the vector of sizes initialized in the first variable
magic_Square_Size represents the size of the current magic
square being processed.
c In the Evaluate expression if there is an error text box, r eplace th e
existing text with the following:
disp(['Error during eval: ', lasterr])
This code executes if an error occurs while attempting to extract a value from
magicSizeVector.
Eval component of the report. The
2-26
The Outline pane on the left looks as follows.
4 Save the report.
Adding Components to the Report Template
Inserting the Magic Square Size into the Report
Insert the size of the magic square into the report using the Paragraph and Insert Variable components.
1 In the Outline pane on the left, select the Eval component.
2 In the Options pane in the middle, under the Formatting category,
double-click
Do not magic
3 In the Outline pane on the left, select the Paragraph component (below
the
for component).
4 In the Options pane in the middle, under the MATLAB category, double-click
Insert Variable.
he Properties pane on the right:
5 In t
Paragraph.
change the properties. T he variable that contains the size of the
square goes in this paragraph.
2-27
2 Creating MATLAB
®
Reports
a In the Variable name text box, enter magic_Square_Size.
b In the Display as list, select Inline text.
The Outline pane on the left looks as follows.
2-28
6 Save the report.
Displaying the Magic Square
To create the magic square and display the associated matrix or image, use theEvaluateMATLABExpressioncomponent.
1 In the Outline pane on the left, select the Paragraph component.
2 In the Options pane in the middle, under the MATLAB category, double-click
Evaluate MATLAB Expression.
e this component a sibling of the
Mak
described in the next two steps.
as
Paragraph component, not a child,
Adding Components to the Report Template
3 In the Outline pane on the left, select the Eval component.
4 Click the left arrow on the toolbar to make the Eval component a sibling of
the previous
5 In the Properties pane on the right:
a Clear the Insert M AT LAB expression in report and Display
Paragraph component.
command window output in report check boxes.
b In the Expression to evaluate in the base workspace text box,
replace the existing text with the following MATLAB code.
Tip Copy and paste this text from the HTML documentation into the Report Explorer.
%This MATLAB script produces a magic %square of size magic_Square_Size %and creates an image of that square.
mySquare=magic(magic_Square_Size); clf imagesc(mySquare); title(sprintf('Magic Square N=%i',magic_Square_Size)) set(gca,'Ydir','normal'); axis equal; axis tight;
This code creates a magic square matrix mySquare of size
magic_Square_Size, and opens an i mage of that matrix in the MATLAB
figure window.
c In the Evaluate expression if there is an error text box, r eplace th e
existing text with the following:
disp(['Error during eval: ', lasterr])
This code executes if an error occurs while creating and displaying the magic square.
2-29
2 Creating MATLAB
®
Reports
The Properties pane on the right looks as follows.
2-30
6 Save the report.
7 In the Outline pane on the left, select the Eval component.
Adding Components to the Report Template
8 On the Op
categor
9 On the Properties pane on the right, in the Test Expression text box,
tions pane in the middle, under the
y, double-click
Logical If.
Logical and Flow Control
replace the existing text with the following text:
magic_Square_Size<=largestDisplayedArray
This command tests if the current matrix size (magic_Square_Size)is less than or equal to the value assigned in the first report (
To process the result of this components—
largestDisplayedArray=15).
Logical If component, create two child
Logical Then and Logical Else.Ifmagic_Square_Size
Eval component of the
is less than or equal to 15, the matrix variable appears in the report. If
magic_Square_Size is greater than 15, the matrix image appears in the
report.
10 On the Outline pane on the left, select the if component.
2-31
2 Creating MATLAB
®
Reports
2-32
11 On the Options pane in the middle, under Logical and Flow Control,
double-click
12 On the Outline pane on the left, select the if component again.
13 On the Options pane in the middle, under Logical and Flow Control,
double-click
The
then component appears above the else component.
Logical Else.
Logical Then.
Adding Components to the Report Template
14 In the Outline pane on the left, select the then component.
15 In the O
Insert
16 In the Properties pane on the right:
a In the Variable name text box, enter mySquare, which is the variable
ptions pane in the middle, under the
Variable
.
MATLAB category, double-click
that contains the magic square of the specified size.
b In the Title list, select None.
c In the Size Limit text box, enter 0.
The Properties pane on the right looks as follows.
2-33
2 Creating MATLAB
®
Reports
2-34
This Var the var
17 In the Outline pane on the left, select the else component.
18 In the Options pane in the middle, under the Handle Graphics category,
iable
iable
double-click
Do not
19 In the Outline pane on the left, select the Figure Loop component.
20 In the Options pane in the middle, under the Handle Graphics category,
change its properties.
double-click
21 In t
he Properties pane on the right:
he Paper orientation list, select
a In t
component displays the magic square matrix, stored in
mySquare.
Figure Loop.
Figure Snapshot.
Portrait.
Adding Components to the Report Template
b In the Image size list, select Custom.
c Under the Image size list, enter [5 4] for the custom image size.
d In the Invert hardcopy list, select Invert.
This option changes dark axes colors to light axes colors, and vice versa.
The Properties pane on the right looks as follows.
2-35
2 Creating MATLAB
®
Reports
2-36
TheOutlinepaneontheleftlookslikethefollowing.
Adding Components to the Report Template
2-37
2 Creating MATLAB
®
Reports

Generating the Repor t

Now the report contains all the components it needs.
Click the Report icon on the toolbar to generate the report. The following displays on your screen.
1 A Message List window appears, displaying informational and error
messages as the report processes. While the report generates, specify the levelofdetailyouwouldliketheMessage List window to display. Options range from 0 (least detail) to 6 (most detail). Click the list located under the title bar of the Message List window to choose an option, as shown here.
2-38
Messag examp
e level 3 (Important messages) is used for the remainder of this
le.
2 An image of the etching appears briefly.
Generating the Report
3 Images of t
4 In the Outline pane on the left of your Report Explorer window, each
wo magic square images of sizes 16 and 32 appear briefly.
component of the report template is highlighted as it is executed.
At the beginning of this tutorial you specified HTML as the output format of this report. When processing finishes, the MATLAB Web browser opens and displays the report’s HTML file.
2-39
2 Creating MATLAB
®
Reports
2-40

Generating Reports

“Setting Report Output Options” on page 3-2
“Converting XML Documents” on page 3-11
“Creating Log Files” on page 3-14
“Generating MATLAB Code from Report Templates” on page 3-15
“Working with Legacy Report Templates” on page 3-18
“Troubleshooting” on page 3-20
3
3 Generating Reports

Setting Report Output Options

In this section...
“Setting Preferences” on page 3-2
“Setting the Report File Folder” on page 3-3
“Setting the Report File Name” on page 3-4
“Setting the Report Format” on page 3-4
“Viewing and Printing Reports” on page 3-8
“Converting English Strings to Other Languages” on page 3-9
“Autosaving Report Templates” on page 3-9
“Reporting Compiled Simulink Model Data” on page 3-9
“Regenerating Images” on page 3-10
“Including a Report Description” on page 3-10
3-2

Setting Preferences

Specify report output settings using the Preferences pane. To open this pane, click File > P references. A list of available options appears in the following table.
ose
on
Opti
mat ID
For
tension
Ex
imulink Images
S
Purp
cify the report output format. Choices
Spe
lude
inc and
Au re
Fo
pecify the format for Simulink
S
nclude in the report. The default is
i
image
Acrobat (PDF), Rich Text format,
Word document. The default is Web (HTML).
tomatically sets the file extension of the
port file according to the value specified for
rmat ID
.Thedefaultishtml.
.
®
images to
PNG 24-bit
Setting Report Output Options
Option
Stateflow Images
HG Images
View command
Visible in Report Explorer
Use version 1.x environment
Animate Report Explorer when generating reports
Purpose
Specify the format for Stateflow®charts to include in the report. The default is
.
image
PNG 24-bit
Specify the format for Handle Graphics®images to include in the report. The default is
24-bit image
.
PNG
Specify the MATLAB command you want to use to view the report.
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 d eselect this check box, then the Microsoft Word document form at is no longer available for reports created using the Report Explorer.
Choose this option to use previous ve rsions of MATLAB Report Generator and Simulink Report Generator interfaces. For more information, see “Using Legacy Interfaces” on page 3-19.
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.

Setting the Report File Folder

Choose a folder to which you have write privileges, to store the report file. A list of options appears in the following table.
Folder Option
Thesamefolderasthe report template
The current working folder
Same as report template
Present working directory
3-3
3 Generating Reports
Folder Option
Temporary folder
Another folder Custom.UsetheBrowse button (...) to select
You can use %<VariableName> notation to specify a folder in the Custom text box. For more information, see “%<VariableName> Notation” on page 9-68 on the documentation.
Text component reference page in the MATLAB Report Generator
Temporary directory
from a list of directories.

Setting the Report File Name

Imagesareplacedinafolderwiththesamenameasthereportfile. For example,
testreport_files.
Choose a file name for the report file, using the op t ions listed in the following table.
testreport.html images are placed in a folder named
3-4
File Name Option
Thesamefilenameasthe report template
Afilenamedifferentfromthe report template name
Use %<VariableName> notation to specify a file name in the Custom text box. For more information, see “%<VariableName> Notation” on page 9-68 on the documentation.
Text component reference page in the MATLAB Report Generator
Same as report template (default)
Custom. Enter the name of the report.

Setting the Report Format

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.
Setting Report Output Options
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 w hich stylesheets you can use with each output format.
Viewer Format Description Stylesheets
Adobe Acrobat Reader
Web browser
Word processor
DocBook
Adobe Acrobat (PDF)
Web (HTML)
(default)
Rich Text Format (RTF)
or Word
Document
DocBook (XML)
Produces a PDF that you can view using Adobe Acrobat Reader software
Use for publishing on the World Wide Web
Compatible with most word-processing packages, including Microsoft Word software
Produces a report in DocBook format
PDF (see “PDF Stylesheets” on page 3-6)
Web (see “Web Stylesheets” on page 3-7)
Print (see “RTF (DSSSL Print) and Word Stylesheets” on page 3-8)
N/A
3-5
3 Generating Reports
Tip To create and use customized styles, see Chapter 6, “Creating Custom
Stylesheets”.
PDF Stylesheets
PDF Stylesheet Description
Standard Print
Simple Print
Compact Simple Print
Large Type Print
Very Large Type Print
Compact Print
Unnumbered Chapters & Sections
Numbered Chapters & Sections
Paginated Sections
Displays title page, table of contents, list of titles
Suppresses title page, table of contents, list of titles
Minimizes page count, suppresses title, table of contents, list of titles
Uses 12-point fo nt (slightly larger than Standard Print)
Uses 24-point font and landscape paper orientation
Minimizes white space to reduce page count
Chapters and sections are not numbered
Chapters and sections are both numbered
Sections are printed with page breaks
3-6
stom Header
Cu
Custom Titlepage
Logo stylesheet for PDF
Verbose Print
ts you specify custom headers and footers
Le
Lets you specify custom title page content and presentation
Lets you specify a logo, such as your company logo, in the header
Lets you specify advanced print options
Web Stylesheets
Web Stylesheet Description
Default HTML stylesheet
Simulink book HTML stylesheet
Truth Table HTML stylesheet
HTML on a single page
HTML on multiple pages; suppresses chapter headings and table of contents
HTML on multiple pages; suppresses chapter headings and table of contents
Setting Report Output Options
Multi-page Web
Single-page Web
Single-page Unnumbered Chapters & Sections
Single­Chapte
Single-page Simple
Multi-page Simple
Multi-page Unnumbered Chapters & Sections
Mul Ch
page Numbered
rs & Sections
ti-page Numbered
apters & Sections
HTML, with each chapter on a separate page
HTML on a s
ingle page
HTML on a single page; chapters and sections are not numbered
HTML on a single page; chapters and sections are numbered
HTML on a single page; suppresses title page and table of contents
HTML and t
HTML are
on multiple pages; suppresses title page
able of contents
on multiple pages; chapters and sections
not numbered.
HTML on multiple pages; chapters and sections are numbered
3-7
3 Generating Reports
RTF (DSSSL Print) and Word Stylesheets
RTF or Word Stylesheet Description
Standard Print
Simple Print
Compact Simple Print
Large Type Print
Very Large Type Print
Compact Print
Unnumbered Chapters & Sections
Numbered Chapters & Sections
Displays title page, table of contents, list of titles
Suppresses title page, table of contents, list of titles
Minimizes page count, suppresses title, table of contents, list of titles
Uses 12-point fo nt (slightly larger than Standard Print)
Uses 24-point font and landscape paper orientation
Minimizes white space to reduce page count
Chapters and sections are not numbered
Chapters and sections are both numbered
3-8
Note Some W eb 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.

Viewing and Printing Reports

To view your report after generation:
To view the report automatically, select the View report after generation
check box in the Generation Options section in the Properties pane on the right. When report ge neration 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, a nd open the file.
To print your report, select the Print option from the viewer.
Setting Report Output Options
Converting Engl
Versions 2.0 and Generator softw Java™ interfac system.
Alternativel MATLAB comman
java.util.Locale.setDefault(java.util.Locale.ITALY)
Alternativ
1 Right-clic
This displays the properties of the report, which are stored in the variable ans. Access the report’s this variable. By default, system’s default language is in use.
2 OverridethedefaultvalueofLanguage by setting this property to your
desired language; for example,
are use the system language settings through the Sun™
e; therefore, they should use the language specified on your
y, you can change the language directly in Java from the
ely, you can set the pre fe rred language directly in your
ktheReport component and select Send to Workspace.
ish Strings to Other Languages
later of the MATLAB Report Generator and Simulink Report
d line. The following example sets the language to Italian:
.rpt file:
Language property from the command line through
Language is auto, which indicates that the
en for English or it for Italian.

Autosaving Report Templates

To automatically save the report template before you generate a report, select Auto save before generation from the Generation Options section of the Properties pane on the right.

Reporting Compiled Simulink Model Data

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 co mpiled values used during simulation. To ensure that a report reflects compiled values, select the Compile model to report on compiled information option. Thisoptioncausesthe 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.
3-9
3 Generating Reports
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.

Regenerating 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.
3-10

Including a Report Description

Use the Report Description field in the Properties pane on the right to record notes and comments about your report template. This text appears in the Properties pane on the right when you select a report template in the Outlinepaneontheleft.

Converting XML Documents

In this section...
“Why Convert XML Documents?” on page 3-11
“Converting XML Documents U sing the Report Explorer” on page 3-11
“Converting XML Documents Using the Command Line” on page 3-13
“Editing XML Source Files” on page 3-13

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.
Converting XML Documents
Note The report-generation process can only convert XML source files created by the latest version of the software.

Converting XML Documents Using the Report Explorer

To open the Convert Properties pane:
1 In 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.
3-11
3 Generating Reports
3-12
2 Select 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.
3 Selec
t your output format and stylesheet:
a In th
b In th
e File format text box, select an output format.
e Stylesheet text box, select a stylesheet. The stylesheet choice
nds on the specified output format. You can use a predefined or
depe
tomized stylesheet.
cus
For more information about available formats and predefined stylesheets, see “Setting the Report Format” on page 3-4.
Converting XML Documents
For more information about customizing stylesheets, see Chapter 6, “Creating Custom Stylesheets”.
4 Use the View Report when done converting check box to indicate
whether you want to view the report after it has conversion.
5 To begin the conversion, click Convert file.

Converting XML Documents Using the Command Line

To convert files using the command line, use the rptconvertfunction.

Editing XML Source Files

Before you send a source file to the converter, edit it as text in the Report Explorer:
1 In the Outline pane on the left, open the File Converter.
2 Right-click MATLAB Report Generator and select Convert source file.
3 In the Options pane in the middle, select the source file to edit.
4 In the Properties pane on the right, click Edit as text.
5 Use the MATLAB Editor to edit and save the text.
3-13
3 Generating Reports

Creating Log Files

A log file describes a report template ’s 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 template
To share information about a report template through e-mail
A log file includes the following information:
Report template 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 same folder as the report template.
<report_template_file_name_log>.html is saved in the
3-14
Generating MATLAB®Code from Report Templates

Generating MATLAB Code from Report Templates

You can generate MAT LAB code versions of report templates in the form of a MATLAB file ( purposes, including generating reports and modifying report templates programmatically.
To generate a MATLAB file, load a report template 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 g enerated file is the report template filename, preceded by “build.”

Generating Reports from MATLAB Files

*.m). A MATLAB file of a report template is useful for various
This example generates a MATLAB file from the
figloop_tutorial.rpt
report template, which is part of the MATLAB Report Generator software. The example then uses the MATLAB file. For more information about this function, see the
report function to generate a report from the
report
reference page.
1 Start the Report Explorer by entering report in the MATLAB Command
Window.
2 In the Options pane in the middle, double-click figloop_tutorial.rpt
to open its report template.
3 In the Outline pane on the left, click Report - figloop_tutorial.rpt
to select it.
4 In the Report Explorer menu bar, click File > Generate MATLAB File.
The MATLAB Report Generator software generates MATLAB code for the
figloop_tutorial.rpt report template. It saves this code in the
buildfigloop_tutorial.m file in the folder you specify. Part of this file
appears in the following figure.
3-15
3 Generating Reports
3-16
5 To generate the figloop_tutorial report from this MATLAB file, run the
following command in the MATLAB Command Window:
report(buildfigloop_tutorial);
The MAT LAB Report Generator software runs and displays the report.
Generating MATLAB®Code from Report Templates
3-17
3 Generating Reports

Working with Legacy Report Templates

In this section...
“What Are Legacy Report Templates?” on page 3-18
“Enabling Legacy Interfaces” on page 3-18
“Using Legacy Interfaces” on page 3-19

What Are Legacy Report Templates?

Legacy report templates are files that you created in previous versions of the MATLAB Report Generator or Simulink Report Generator software. You can load legacy report templates in the current version of the Report Explorer. Alternatively, you can use earlier versions of the product interfaces to work with legacy report templates.

Enabling Legacy Interfaces

Enable the previous versions of the interfaces at the MATLAB command line:
3-18
RptgenML.v1mode(true)
The result is:
ans =
1
Alogical1 indicates that Version 1 mode is on. To turn off Version 1 mode, enter:
RptgenML.v1mode(false)
The result is:
ans =
0
Alogical0 indicates that Version 1 mode is off.
Working with Legacy Report Templates

Using Legacy Interfaces

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 template created in the latest version of the
MATLAB Report Generator or Simulink Report Generator software with earlier interfaces. If you save a legacy report template in the latest version of the software, you can no longer work with the same report template 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 E ditor can coexist with the Report Explorer, but The MathWorks™ does not recommend using these interfaces together.
3-19
3 Generating Reports

Troubleshooting

In this section...
“Managing Memory Usage” on page 3-20
“Displaying HTML Reports on UNIX Systems” on page 3-21

Managing 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 inform ation.
Running the MATLAB Software Without a Desktop
One w ay 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.
3-20
Note This option is available on UNIX®platformsonly.(UNIXisaregistered trademark of The Open Group in the United States and other countries.)
Increasing the MATLAB JVM Memory Allocation Limit
Increase the amount of JVM memory available by increasing the MATLAB JVM memory allocation limit.
1 Create a file named java.opts. In this file, include the -Xmx option,
specifying the amount of memory you want to allocate to the JVM software. For example, to increase the JVM memory a llocation limit to 128 MB, use the following syntax in the
-Xmx128m
java.opts file:
Troubleshooting
Caution To avoid virtual memory thrashing, never set the -Xmx option to more than 66% of available physical RAM.
2 Put the java.opts file into the appropriate folder. Where you put the file
depends on what operating system you are running.
On UNIX systems, put the
java.opts file in the folder where you intend
to start the MATLAB software session, and navigate to that folder before doing so.
On Microsoft Windows
a Put the java.opts file in a folder where you intend to start the
®
systems:
MATLAB software session.
b Create a shortcut to the MATLAB software.
c Right-click the shortcut and select Properties.
d In the Properties dialog box, speci fy the MATLAB startup folder for
the name of the folder in which you created the
®
On Apple
/Applications/matlab folder.
Mac OS®systems, put the java.opts file into the
java.opts file.

Displaying HTML Reports 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:
1 In the Report Explorer, click File > Preferences.
2 Enter the following text in the View command field:
web(rptgen.file2urn('%file name'), '-browser')
Where file name is the name of your report template file.
3-21
3 Generating Reports
3-22

Working with Components

“About Components” on page 4-2
“Working with Looping Components” on page 4-3
“Working with Property Table Components” on page 4-9
“Working with Summary Table Components” on page 4-21
4
4 Working with Components

About Components

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 template. You use com ponents to customize the appearance and output of reports.
The following sections provide examples of how to use different types of components.
4-2

Working with Looping Components

In this section...
“About Looping Components” on page 4-3
“Editing the Figure Loop Tutorial Report Template” on page 4-3
“Displaying Figures” on page 4-4
“Editing Figure Loop Components” on page 4-4

About Looping Components

A looping component runs its child components a specified number of times. There are several looping components, including logical loops and Handle Graphics loops.
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 con tro l aspects such as the order in which the report sorts blocks.
Working with Looping Components
The following example uses the Figure Loop, which is representative of many types of loops. The Figure Loop component runs its child components several times. In each iteration, it applies its child components to Handle Graphics figures. The Report Gene rator software, cre ates a report that documents multiple Handle Graphics figures.
For background information, see “Understanding Handle Graphics Objects” in the MATL AB documentation.
figloop-tutorial report template, included with the MATLAB

Editing the Figure Loop Tutorial Report Template

To edit the figure loop tutorial report template, at the MATLAB command prompt, enter the following command:
setedit figloop-tutorial
4-3
4 Working with Components
Displaying Figu
To display the Ha command line:
figloopfigures
The figures Me screen becaus
and An In
Data
because thei they are hidd
“Figure Pro this tutori
al.
Editing Fi
Select th Outline p appears.
e F igure Loop component called
ane on the left. The Properties pane for the Figure Loop component
ndle Graphics figures, enter the following at the MATLAB
mbrane Data
etheir
visible Application
r
visible property is 'off'. These invisible figures exist, but
en.
perties” on page 4-5 describes the properties of figures used in
gure Loop Components
res
, An Application,andPeaks Data appear on the
visible property is 'on'.TheInvisible Membrane
figures do not appear on screen
Figure Loop Section 1 from th e
4-4
Working with Looping Components
eProperties
Figur
You can control what figures get displayed in the report, bas ed on the properties of each figure.
Table 1.1 of the properties of the figures used in this tutorial.
figloop-tutorial report includes a summary of the
4-5
4 Working with Components
For this tutorial, you will not change these properties. For background information, see “Setting and Querying Property Values” in the MATLAB documentation.
Looping on the Current Figure
To include only the current figure in the report, select Current figure only from the Include figures selection list. In this case, “current figure” refers to the figure that is current when the report generates. This may not be the same figure you selected as the current figure in the Report Explorer before report generation. For example, if the report generation process creates figures in your report, the last figure created with to
'on' is the current figure.
HandleVisibility set
4-6
Looping on Visible Figures
To include snapshots of a ll visible figures in your report, select Visible
figures
and Property Table for all figures that a re currently open and visible.
1 Select the Data figures only (Exclude applications) option to ex clude
2 Click the Report button in the Report Explorer toolbar to generate the
In the generated report, scroll down to “Chapter 2 Figures in Report.” The
Membrane Data and Peaks Data figures appear in the generated report.
in the Include figures selection list. This option inserts a snapshot
figures from the loop whose
report.
HandleVisibility parameter is 'off'.
Looping on Figures with Tags
To include figures with specified tags in the report:
Working with Looping Components
1 Select the All figures with tags option in the Include figures
selection list.
2 In the list of tags, delete membrane.
3 Click Report to generate the report.
The
An Application and An Invisible Application figures appear in the
report. They both have an
app tag.
Modifying Section Options
In a loop, a section refers to a space in the generated report in which information, including text, images, and tables, appears. Yo u can alter the appearance of sections in each loop appear in the report by using the options in the Figure Loop component’s Section Options pane.
Create Section for Each Object in Loop. With this option selected, the loop automatically creates an individual section for each object found in the loop. It uses the object title as the section title. This option is useful when a loop does not contain a Chapter/Subsection component that organizes the loop results.
Display the Object Type in the Section Title. Enable this option by selecting Create section for each object in loop. The generated report precedes section titles with object titles.
1 Enter membrane back in the list of tags.
2 Generate the figloop-tutorial report.
The figures produced by the loop are:
Membrane Data Invisible Membrane Data An Application An Invisible Application
3 Enable the Display the Object Type in the Section Title option.
4 Generate the figloop-tutorial report.
4-7
4 Working with Components
The figures produced are now:
Figure - Membrane Data Figure - Invisible Membrane Data Figure - An Application Figure - An Invisible Application
The figures produced are now:
Figure - Membrane Data Figure - Invisible Membrane Data Figure - An Application Figure - An Invisible Application
Create a Link Anchor for Each Object in Loop. Selecting this option creates a hyperlink to the object in the generated report.
4-8

Working with Property Table Components

Working with Property Table Components
In this section...
“About Property Table Components” on page 4-9
“Opening the Example Report Template” on page 4-11
“Examining the Property Table Output” on page 4-11
“Selecting Object Types” on page 4-12
“Displaying Property Name/Property Value Pairs” on page 4-12
“Editing Table Titles” on page 4-15
“Entering Text into Table Ce ll s” on page 4-15
“Adding, Replacing, and Deleting Properties in Tables” on page 4-16
“Displaying or Hiding CellBorders”onpage4-17
“Adding and Deleting Columns and Rows” on page 4-18
“Resizing Columns” on page 4-18
“Merging and Splitting Cells” on page 4-18
“Zooming and Scrolling” on page 4-19
“Selecting Tables” on page 4-19

About Property Table Components

Property Table components display property name/property value pairs for objects in tables. This appears in the following example table from the
figloop-tutorial report.
4-9
4 Working with Components
4-10
Many t
MATLA
Simu
Stat
The c Pro
ypes of Property Table components are avai lable, includ ing:
B Property Table
link Property Table
eflow Property Table
omponent used in this example represents MATLAB Report Generator
perty Table components, all of which exhibit similar behavior.
Working with Property Table Components
Opening the Exam
sthe
This example use loop tutorial re line:
setedit figloop-tutorial
port template, enter the following at the MATLAB command
Examining the
Property pag Outline pane settings, in button.
es fo r all Property Table components are similar in form. In the ,selectthe
the Handle Graphics Property Table dialog box, click the Edit...
figloop-tutorial report template. To open the figure
Property Table Output
Figure Prop Table component. To modify table
ple Report Template
4-11
4 Working with Components
Selecting Objec
Property Table c example, the Han axes object, or
You can select list in the com
a Handle Graphics object.
a d iffe rent object type on which to report in the Object type
ponent’s Properties pane.
Displaying P
tTypes
omponents offer multiple object types on which to report. For
dle G raphics Property table lets you report on a figure, an
roperty Name/Property Value Pairs
Splitting Property/Value Cells
1 InthePropertiespanefortheHandleGraphics Property Table component,
clear the Split property/value cells check box.
2 Click Edit.Thetableisnowinnonsplit mode. Nonsplit mode supports
more than one property name/property value pair per cell and text.
4-12
Loading...