Main Content class


Report container

Description is a container for a report based on Simulink® reporters and DOM objects. Use this object to generate an HTML, PDF, or Word report based on templates in a template library.


Use objects of this type, instead of, to create Simulink reports, which are reports that use Simulink reporters to generate content. You can also use MATLAB® reporters and DOM objects to generate Simulink report content.


report = returns a report object report with the default report type (PDF) and a default file name (untitled.pdf).

report = uses the specified output path for the report.

report =,type) creates the specified type of report.

report =,type,template) uses the specified template.

report = sets properties using name-value pairs. You can specify multiple name-value pair arguments in any order.

Input Arguments

expand all

See the OutputPath property.

See the Type property.

See the TemplatePath property.


expand all

Report document output path, specified as a string or character array. The path is the location in the file system where the report output document is stored. The path can be a full path or a path relative to the current MATLAB folder, for example, 'C:/myreports/reportA.docx' or 'reportA'. If the file name does not have a file extension corresponding to the Type property, the appropriate file extension is added.


Generating a PDF report on a cloud drive, such as MATLAB Drive™, can result in an error that is caused by file contention between the report generation software and the cloud drive synchronization software. To avoid this error, generate reports on a local drive that does not synchronize with the cloud. Consider writing a script that generates a report on a local drive and then copies the report to the cloud drive.

Output type, specified as one of these values.

  • 'HTML' — HTML report packaged as a zipped file containing the HTML file, images, style sheet, and JavaScript® files of the report.

  • 'HTML-FILE' — HTML report as a single HTML file containing the text, style sheet, JavaScript, and base64-encoded images of the report

  • 'PDF' — PDF file

  • 'DOCX'Microsoft® Word document

If you specify a template using the TemplatePath property, the value for Type must match the template type.

Page layout options for this report, specified as a report layout object. See

Locale or language, specified as the ISO 639-1 two-letter language code of the locale for which this report is to be generated. The default [] specifies the language of the system locale, for example, English on an English system. The Report API uses the language code to translate chapter title prefixes to the language of the specified locale. Translations are provided for the following locales: af, ca, cs, da, de, el, en, es, et, eu, fi, fr, hu, id, it, ja, ko, nl, nn, no, pl, pt, ro, ru, sk, sl, sr, sv, tr, uk, xh, and zh. If you specify an unsupported locale, the English version is used. See ISO 639-1 codes.

Location of template used to format the report, specified as a string or character array. Use this property to specify a custom template for this report.

This read-only property is an mlreportgen.dom.Document that is used to generate the content of the report.

This read-only property is a containers.Map object that contains information for generating the report, such as the hierarchical level of the current report section.

Debug mode, specified as a logical. If you set Debug to true, the temporary files for the report are stored in a subfolder of the report folder. In debug mode, these files are not deleted when the report is closed.

Whether to compile the Simulink model before reporting, specified as a logical. If this property is true and the model is not already compiled, it compiles when you add a reporter that reports on that model to this report. If the model cannot be compiled, report generation terminates. If this property is false, report generation proceeds without compiling the model.


This class uses the same methods as the MATLAB version. Instead of using mlreportgen in the class name, use slreportgen. See for a list of methods.

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects.

Version History

Introduced in R2017b

expand all