User`s guide
13 Create a Report Program
13-6
Construct a DOM Object
The DOM API includes a special set of MATLAB functions, called constructors, for
creating DOM objects of various types, or classes.
The name of an object constructor is the name of the MATLAB class from which the
DOM creates an object. For example, the name of the constructor for a DOM paragraph
object is mlreportgen.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, the following line creates a paragraph whose
initial content is Chapter 1.
p = mlreportgen.dom.Paragraph('Chapter 1.');
A constructor returns a handle to the object it creates. Assigning the handle to a variable
allows you to subsequently append content to the object or set its properties. For
example, the following line appends content to the paragraph object p created in the
previous example.
append(p,'In the Beginning');
Note that you can assign an object handle to multiple variables and hence access the
same object via multiple variables.
Related Examples
• “Import the DOM API Package” on page 13-7
• “Get and Set DOM Object Properties” on page 13-8
More About
• “Document Object Model” on page 13-4