Main Content

Construct a Report API or DOM API Object

The Report API and DOM API include a set of MATLAB®functions, called constructors, for creating objects of various types, or classes.

The name of an object constructor is the name of the MATLAB class from which the API creates an object.

Construct a Report API Object

The qualifier for Report API constructor names ismlreportgen.report. For example, the name of the constructor for a Report API chapter object ismlreportgen.report.Chapter. Some constructors do not require any arguments. Other constructors can take one or more arguments that typically specify its content and properties. For example, this code creates a chapter whose title is我的章.

chap = mlreportgen.report.Chapter('My Chapter');

A constructor returns a handle to the object it creates. Assigning the handle to a variable allows you to add content to the object or set its properties. For example, this code adds a section with a title to the chapter objectchap.

append(chap,Section('Detailed Description'));

Construct a DOM API Object

The qualifier for DOM API constructor names ismlreportgen.dom. For example, the name of the constructor for a DOM paragraph object ismlreportgen.dom.Paragraph. Some constructors do not require any arguments. Other constructors can take one or more arguments that typically specify its initial content and properties. For example, this code creates a paragraph whose initial content isChapter 1.

para = mlreportgen.dom.Paragraph('Chapter 1.');

A constructor returns a handle to the object it creates. Assigning the handle to a variable allows you to append content to the object or set its properties. For example, this code appends content to the paragraph objectp.

append(para,'In the Beginning');

Related Topics