Main Content

slreportgen.report.EnumerationType Class

Namespace: slreportgen.report

Simulink enumerated data type reporter

Since R2023b

Description

Use an object of the slreportgen.report.EnumerationType class to report on enumerated types used in Simulink® models and submodels. Instances of this class are returned by the getReporter method of slreportgen.finder.EnumerationTypeResult objects. Adding this reporter to a report, without any modifications, adds enumeration-type information based on the default settings. Use the reporter properties to specify the report options.

Note

You can use this reporter only with reports of the slreportgen.report.Report class.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

You do not need to create an slreportgen.report.EnumerationType object yourself. Instances of this class are returned by the getReporter method of slreportgen.finder.EnumerationTypeResult objects. Adding this reporter to a report, without any modifications, adds enumeration-type information based on the default settings. Use the reporter properties to specify the report options.

Properties

expand all

Simulink.VariableUsage object for the variable represented by this result.

Attributes:

SetAccess
protected

Specifies a reporter to use to report and format the enumeration-type properties in a tabular form that is, in a property-value pair table. The default value of this property is an object of mlreportgen.report.BaseTable type. You can customize the appearance of the table by customizing the default reporter or by replacing it with a customized version of the BaseTable reporter. See the mlreportgen.report.BaseTable documentation or command-line help for information on customizing this reporter. Any content that you specify in the Title property of the default or the replacement reporter will appear before the title in the generated report. This example to shows what the BaseTablereports on when you:

  • Define an enumeration type in a MATLAB® file

    Table 1.1. ON_OFF_TYPE Properties

    PropertyValue
    NameON_OFF_TYPE
    Source TypeMATLAB file
    SourceON_OFF_TYPE.m
    Members
    • OFF(0)

    • ON(1)

    • FAILEDANDCLOSE(2)

    Default ValueOFF(0)

  • Define an enumeration type dynamically.

    Table 1.1. BasicColors Properties

    PropertyValue
    NameBasicColors
    Source TypeDynamic class
    SourceDefine by Simulink.defineIntEnumType
    Members
    • Blue(0)

    • Red(1)

    • Yellow(2)

    Default ValueBlue
  • Define an enumeration type in a data dictionary.

    Table 1.1. BasicColors Properties

    PropertyValue
    NameBasicColors
    Source TypeData dictionary
    Sourcesldemo_fuelsys_dd_controller.dd
    Enumeration Members
    • Blue(0)

    • Red(1)

    • Yellow(2)

    Default ValueBlue

Specify the names of enumeration properties to report, specified as a cell array of strings or character vectors. The default value of this property is a cell array of enumeration properties {"Name","Source Type","Source","Members","Default Value"}. You can customize this cell array from the following enumerated type properties:

Enumerated Type Properties

"Name"
"Source Type"
"Source"
"Members"
"Default Value"
"Header File"
"Description"

Data Types: cell

Whether to show a list of the blocks that use the enumeration type, specified as true or false. If the ShowUsedBy property is set to true, the reporter includes a list of the blocks that use the bus object in the report. If the ShowUsedBySnapshot property is also set to true, the reporter includes a diagram snapshot for each parent subsystem that uses the enumeration type. Blocks that use the enumeration type are highlighted in the snapshot.

Data Types: logical

Formatter for the enumeration type lists, specified as an mlreportgen.dom.OrderedList object or mlreportgen.dom.UnorderedList object. The OrderedList or UnorderedList object must not contain list items.

The default value of this property is an OrderedList object with the StyleName property set to the ExecutionOrderList style, which is defined in the default template for an ExecutionOrder reporter. To customize the appearance of the list, modify the properties of the default OrderedList object or replace the object with a your own OrderedList or UnorderedList object.

This property specifies whether to include the MATLAB code that defines the enumeration type, specified as true or false. The default value is false.

Note

This property applies only when you define the enumeration type in an M file.

Data Types: logical

Specify a mlreportgen.dom.Paragraph object to fill with the title content for the MATLABCodeReporter code, specified as a mlreportgen.dom.Paragraph object. The default value of this property is an empty mlreportgen.dom.Paragraph object whose properties specify the appearance of the source code title. By default, the EnumerationType reporter generates a title from the enumerated data type name and appends it to the paragraph. The generated title consists of the enumerated type name followed by "Source Code". For example, an enumerated type of "ON_OFF_TYPE" generates the title "ON_OFF_TYPE Source Code". You can customize the title appearance by modifying the properties of the default paragraph object or by replacing it with another paragraph object. Any content that you add to the default or replacement paragraph appears before the title in the generated report. See the mlreportgen.dom.Paragraph documentation or command-line help for information on customizing the DOM paragraph formats.

Note

This property applies only when the IncludeMATLABCode property is set to true.

Specify a reporter to report and format the MATLAB code that defines the enumeration type, specified as a mlreportgen.report.MATLABCodeobject. The default value of this property is a mlreportgen.report.MATLABCode object. To customize the code appearance, modify the properties of the default MATLABCode reporter or replace the reporter with a custom reporter. See the mlreportgen.report.MATLABCode documentation or command-line help for information on customizing this reporter.

Note

This property applies only when the IncludeMATLABCode property is set to true.

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 you append this report. 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.

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.

Data Types: char | string

Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar value converts to a LinkTarget object. The link target immediately precedes the content of this reporter in the output report.

Methods

expand all

Examples

collapse all

Customize the formatting of model variables in a report by iterating through the search results and setting properties of the model variable reporter for each result.

% Create a Report
rpt = slreportgen.report.Report("MyReport","docx");
 
% Create a Chapter
chapter = mlreportgen.report.Chapter();
chapter.Title = "EnumerationType Reporter Example";
 
% Load the model
model_name = "EnumExample";
load_system(model_name);
 
% Find the enumerated types in the model
finder = slreportgen.finder.EnumerationTypeFinder(model_name);
 
while hasNext(finder)
    result = next(finder);
     
    % Get the EnumerationType reporter for the result and set the IncludeMATLABCode property to true
    reporter = getReporter(result);
    reporter.IncludeMATLABCode = true;
     
    % Add the reporter to the chapter
    append(chapter,reporter);
end
% Add chapter to the report
append(rpt,chapter);
 
% Close the report and open the viewer
close(rpt);
rptview(rpt);

Version History

Introduced in R2023b