Main Content

append

Class: mlreportgen.report.Section
Package: mlreportgen.report

Add content to section

Syntax

append(section,content)

Description

append(section,content) adds the specified content to the specified section.

Input Arguments

expand all

Section of the report, specified as an mlreportgen.report.Section object.

Content to add to the section, specified as one of these values:

  • Report API reporter

  • DOM object

  • Built-in MATLAB® object (many built-in MATLAB objects can be added to a Section reporter)

  • Cell array of objects that can be added individually to a section

Examples

expand all

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.

close(rpt);
rptview(rpt);
Introduced in R2020b