Main Content

add

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

(Not recommended) Add content to section

Syntax

add(section,content)

Description

Note

add is not recommended. Use append instead. See Compatibility Considerations.

add(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 (most 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

Add content to a paragraph and add the paragraph to a section of a chapter. To add the content to the paragraph, you must use append because a paragraph is a DOM API object. To add the paragraph to the section, the section to the chapter, and the chapter to the report, this example uses add. Starting in R2020b, you can use append instead of add. See Compatibility Considerations.

import mlreportgen.dom.*
import mlreportgen.report.*

rpt = Report("My Report");
ch = Chapter("My Chapter");
s = Section("My Section");
p = Paragraph("My paragraph content ");
append(p,"and some more content.");
add(s,p);
add(ch,s);
add(rpt,ch);

close(rpt);
rptview(rpt);

Version History

Introduced in R2017b

expand all