Main Content

slreportgen.report.Annotation class

Package: slreportgen.report
Superclasses: slreportgen.report.Reporter

Report on Simulink annotations

Description

Use objects of the class slreportgen.report.Annotation to report on Simulink.Annotation objects.

The slreportgen.report.Annotation class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

rptr = slreportgen.report.Annotation() creates an empty Annotation reporter based on the default template. Set the Object property before you add the reporter to a report.

example

rptr = slreportgen.report.Annotation(annotationObj) creates an Annotation reporter and sets the Object property to annotationObj.

example

rptr = slreportgen.report.Annotation(Name1=Value1,...,NameN=ValueN) creates an Annotation reporter and sets properties using name-value arguments. You can specify multiple name-value arguments in any order.

Note

slreportgen.report.Annotation reporters cannot report on single-image annotations and equations inside annotations.

Properties

expand all

Annotation to report on, specified as a Simulink.Annotation handle or search result object found by an slreportgen.finder.AnnotationFinder or slreportgen.finder.DiagramElementFinder finder.

To obtain handles to Simulink.Annotation objects, use the find_system function. For example:

load_system(model_name);
handleArray = find_system(model_name,findall=true,type="annotation");

Attributes:

GetAccess
public
SetAccess
public

Source of the template for this reporter, specified in one of these ways:

  • Character vector or string scalar that specifies the path of the file that contains the template for this reporter

  • Reporter or report whose template is used for this reporter or whose template library contains the template for this reporter

  • DOM document or document part whose template is used for this reporter or whose template library contains the template for this reporter

The specified template must be the same type as the report to which this reporter is appended. For example, for a Microsoft® Word report, TemplateSrc must be a Word reporter template. If the TemplateSrc property is empty, this reporter uses the default reporter template for the output type of the report.

Attributes:

GetAccess
public
SetAccess
public

Name of the template for this reporter, specified as a character vector or string scalar. The template for this reporter must be in the template library of the template specified by the TemplateSrc property of this reporter.

Attributes:

GetAccess
public
SetAccess
public

Hyperlink target for this reporter, specified as a string scalar, character vector, or mlreportgen.dom.LinkTarget object. The link target immediately precedes the content of this reporter in the output report.

Attributes:

GetAccess
public
SetAccess
public

Methods

expand all

Examples

collapse all

This example shows how to report on a Simulink annotation.

Import these packages, so you do not have to use long, fully qualified class names.

import slreportgen.finder.*
import slreportgen.report.*
import mlreportgen.report.*

Create a report of type PDF.

rpt = Report("AnnotationReport","pdf");

Open the model. Then create an slreportgen.finder.AnnotationFinder object to search the model for Simulink.Annotation elements.

model_name = "annotationReporterExampleModel";
open_system(model_name);
annotationFinder = AnnotationFinder(model_name);

Use the finder to find the annotation elements in the model. Then create an mlreportgen.report.Chapter object to use for the annotations found in the model.

annotationResults = find(annotationFinder);
annotationChapter = Chapter("Annotations");

Iterate through the results and for each create an Annotation reporter, and append the reporter to the chapter.

for idx = 1:length(annotationResults)
  annotationReporter = Annotation(annotationResults(idx));
  append(annotationChapter,annotationReporter);
end

Append the chapter to the report.

append(rpt,annotationChapter);

Close the report and the model, and then view the report.

close(rpt);
close_system(model_name);
rptview(rpt);

Version History

Introduced in R2022b