The MATLAB® Report Generator™ includes classes that allow you to create report generator programs. These programs can generate Word, HTML, and PDF reports. The programs must include certain items and can include some optional items, both of which are listed here and described at each associated link. For information on Report API and how it compares to the Document Object Model (DOM), see, What Is a Reporter?.
All report generator programs must:
Create a report container. See Create Report Container.
Report API Reporters
DOM API objects
MATLAB objects (doubles, cell arrays, MATLAB tables, strings, and so on)
Close the report container. See Close a Report.
Optionally, in report generator programs, you:
Import Report API classes, which enables using non-fully qualified
Report API class names, for example,
mlreportgen.report.TitlePage. See Import the API Packages.
Import DOM API classes, if the program adds DOM objects to the report, which enables using non-fully qualified DOM API class names.
Configure reporters by setting their property values. See Content Generation.
Add content to reporters by using the
The only reporters you can both configure and add content to
Chapter reporter is a subclass of
Display the report to see the generated report output. See Display Report.
Display report progress messages to monitor report progress. See Display Progress and Debugger Messages.
For example, this MATLAB code generates and displays a PDF report. It includes both required and optional items:
% Import report API classes (optional) import mlreportgen.report.* % Add report container (required) rpt = Report('output','pdf'); % Add content to container (required) % Types of content added here: title % page and table of contents reporters titlepg = TitlePage; titlepg.Title = 'My Airplane'; titlepg.Author = 'Pilot A'; add(rpt,titlepg); add(rpt,TableOfContents); % Add content to report sections (optional) % Text and formal image added to chapter chap = Chapter('Plane Image'); add(chap,'Here is the plane:'); add(chap,FormalImage('Image',... which('b747.jpg'),'Height','5in',... 'Width','5in','Caption','Boeing 747')); add(rpt,chap); % Close the report (required) close(rpt); % Display the report (optional) rptview(rpt);