List of figures reporter
Use an object of the
mlreportgen.report.ListOfFigures class to create a
reporter that adds a list of figures section to a report. The generated list of figures
contains the captions of the figures (images) that are represented as
mlreportgen.report.Figure objects in your report generation program. The list
entries link to the captions in the report. In PDF and Word reports, the list also includes
the page numbers of the captions in the report. A leader fills the space between a caption and
its page number.
The way the list of figures is generated depends on the report type:
PDF — The Report API generates the list during report generation.
Word — The Report API generates a placeholder for the list. To generate the list items, you must update the Word document in your report generation program or in Word. See Update Tables of Contents and Generated Lists in Word Documents.
HTML — The Report API generates a placeholder for the list. When the report opens in an HTML browser, the browser generates the list in a sidebar.
mlreportgen.report.ListOfFigures class is a
For information on class attributes, see Class Attributes.
lof = mlreportgen.report.ListOfFigures()
ListOfFigures reporter with default property values.
lof = mlreportgen.report.ListOfFigures(
ListOfFigures reporter with the Title
property set to the specified title.
sets properties using name-value pairs. You can specify multiple name-value pair arguments
in any order.
lof = mlreportgen.report.ListOfFigures(
Title — List of figures section title
 | string scalar | character vector | inline DOM object |
mlreportgen.report.Title object | ...
List of figures section title, specified as one of these values:
String scalar or character vector
Inline DOM object, such as an
1-by-N or N-by-1 array of string scalars or inline DOM objects
1-by-N or N-by-1 cell array that contains any combination of strings, character vectors, or inline DOM objects
mlreportgen.report.Titleobject returned by the
If you do not specify the
Title property, the title is
List of Figures.
LeaderPattern — Type of leader
'.' (default) | 'dots' |
' ' | 'space'
Type of leader to use between the caption and the page number, specified as one of these character vectors or string scalars:
This property applies only to PDF reports. Word reports always have a dots leader. HTML reports do not have a leader.
Layout — Page layout
Page layout for the list of figures section, specified as an
mlreportgen.report.ReporterLayout object. Use the properties of the
ReporterLayout object to override the some of the default page layout
properties, such as page orientation.
TemplateSrc — Source of template for this reporter
 (default) | character vector | string scalar | reporter or report | DOM document or document part
Source of the template for this reporter, specified as one of these options:
Character vector or string scalar that specifies the path of the file that contains the template for this reporter
Reporter or report whose template is used for this reporter or whose template library contains the template for this reporter
DOM document or document part whose template is used for this reporter or whose template library contains the template for this reporter
The specified template must be the same type as the report to which this
reporter is appended. For example, for a Microsoft® Word report,
TemplateSrc must be a Word reporter template. If
TemplateSrc property is empty, this reporter uses the default
reporter template for the output type of the report.
TemplateName — Name of template for this reporter
character vector | string scalar
Name of template for this reporter, specified as a character vector or string scalar.
The template for this reporter must be in the template library of the template source
TemplateSrc) for this reporter.
LinkTarget — Hyperlink target for this reporter
 (default) | character vector | string scalar |
Hyperlink target for this reporter, specified as a character vector or string scalar
that specifies the link target ID or as an
mlreportgen.dom.LinkTarget object. A character vector or string scalar
value is converted to a
LinkTarget object. The link target immediately
precedes the content of this reporter in the output report.
|Create list of figures reporter template|
|Create custom list of figures reporter class|
|Get location of list of figures reporter class definition file|
|Create copy of reporter object and make deep copies of certain property values|
|Get implementation of reporter|
|Get list of figures title reporter|
Generate a List of Figures Section in a Report
This example uses an
mlreportgen.report.TableOfContents reporter to add a table of contents to a report and an
mlreportgen.report.ListOfFigures reporter to add a section for a list of figures. The figures (images) in the report are represented as
mlreportgen.report.FormalImage objects so that the
ListOfFigures reporter includes them in the list of figures.
Import the Report API package so that you do not have to use long, fully qualified class names.
Create a report.
rpt = Report("myFigureReport","pdf"); open(rpt);
Create a table of contents and add it to the report.
toc = TableOfContents(); append(rpt,toc);
Create a list of figures section and add it to the report.
lof = ListOfFigures(); lof.Title = "My List of Figures"; append(rpt,lof);
Create a chapter and add a captioned image and figure to the chapter.
ch = Chapter("Images"); image1 = FormalImage(which("peppers.png")); image1.Caption = "Peppers"; image1.Height = "5in"; append(ch,image1); surf(peaks); fig = Figure(); fig.Snapshot.Caption = '3-D shaded surface plot'; fig.Snapshot.Height = '5in'; append(ch,fig);
Add the chapter to the report. Close and view the report.
delete(gcf); close(rpt); rptview(rpt);
Here is the list of figures in the report:
Introduced in R2020b