Add content to section
section— Section of the report
Section of the report, specified as an
content— Content to add to section
Content to add to the section, specified as one of these values:
Report API reporter
Built-in MATLAB® object (many built-in MATLAB objects can be added to a
Cell array of objects that can be added individually to a section
This example generates a report that has a title page and one chapter. The chapter contains two sections, each of which contains an image. The example uses
append to add the content to the images, the images to the sections, the sections to the chapter, and the chapter and title page to the report.
Import the DOM and API packages so that you do not have to use long, fully qualified class names.
import mlreportgen.report.* import mlreportgen.dom.*
Create a report and add a title page to the report.
rpt = Report("My Report","pdf"); append(rpt,TitlePage("Title","My Report"));
Create a chapter with two sections. Add an image to each section. Add the sections to the chapter and the chapter to the report.
ch = Chapter("Images"); sect1 = Section("Boeing 747"); append(sect1,Image("b747.jpg")); append(ch,sect1); sect2 = Section("Peppers"); append(sect2,Image("peppers.png")); append(ch,sect2); append(rpt,ch);
Close and view the report.