Main Content

getCaptionReporter

Class: mlreportgen.report.FormalImage
Namespace: mlreportgen.report

Get image caption reporter

Syntax

reporter = getCaptionReporter(image)

Description

reporter = getCaptionReporter(image) returns a reporter that generates the formal image caption based on the Caption property of mlreportgen.report.FormalImage. The caption can be any MATLAB® or DOM object that can be appended to a DOM Paragraph. The caption formats override any corresponding formats in the template. Use this getCaptionReporter method to override the default caption formats.

Input Arguments

expand all

Source of image to add to report, specified as a character vector or character array, or as a DOM Image object. If you use a character vector or character array, specify the system path to the image file.

Output Arguments

expand all

Formal image caption reporter for the image, returned as a reporter object.

Examples

Use Non-Default Caption Style

Create a style for your caption that differs from the default style. Before you run this example, create a template named MyCaptionTemplate and customize its FormalImageCaption style. Then, use the getCaptionReporter method and the TemplateSrc property to use your template.

import mlreportgen.report.*
rpt = Report();
image = FormalImage();
captionReporter = getCaptionReporter(image);
image.TemplateSrc = 'MyCaptionTemplate';
add(rpt,image);

Version History

Introduced in R2017b