Main Content

add

Class: mlreportgen.report.Report
Namespace: mlreportgen.report

(Not recommended) Add content to report

Syntax

add(report,content)

Description

Note

add is not recommended. Use append instead. See Version History.

add(report,content) adds the specified content to the specified report. If the report is not already open, the add method opens it.

Note

You can add a reporter to a report multiple times, but you cannot add the reporter to different reports. For example, if you add an mlreportgen.report.TitlePage reporter to one report, you cannot add it to another report.

Input Arguments

expand all

Report, specified as a report object. To create the report input, use mlreportgen.report.Report.

Content to add to report, specified as a Report API reporter, DOM object, or built-in MATLAB® object. The content can be a Report API reporter or any object that you can append to a DOM document. Content that you can append to a DOM document includes DOM objects and many built-in MATLAB objects, such as strings, character vectors, and cell arrays.

Examples

expand all

Add content to a paragraph and add the paragraph to a report. 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 report, which is a Report API object, this example uses add. Starting in R2020b, you can use append instead of add. See Version History.

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

rpt = Report("My Report");
p = Paragraph("My paragraph content ");

append(p,"and some more content.");
add(rpt,p);

close(rpt);
rptview(rpt);

Version History

Introduced in R2017b

collapse all