Main Content

slreportgen.report.ModelConfiguration class

Package: slreportgen.report

Model configuration set reporter

Description

Use an object of the slreportgen.report.ModelConfiguration class to report on the active configuration set of a model.

Note

To use an slreportgen.report.ModelConfiguration reporter in a report, you must create the report using the slreportgen.report.Report class or subclass.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

reporter = slreportgen.report.ModelConfiguration() creates an empty ModelConfiguration reporter object based on the default template. You must specify a model for which to report the active configuration set by setting the Model property. Use other properties to specify report options.

example

reporter = slreportgen.report.ModelConfiguration(model) creates a ModelConfiguration reporter object and sets the Model property to the specified model.

reporter = slreportgen.report.ModelConfiguration(Name,Value) sets the reporter properties using name-value pairs. You can specify multiple name-value pair arguments in any order. Enclose each property name in single or double quotes.

Properties

expand all

Name or handle of open or loaded Simulink® model, specified as a string scalar, character vector, or handle.

Configuration set title, specified as a character vector, string scalar, mlreportgen.dom.Text object, mlreportgen.dom.InternalLink object, or mlreportgen.dom.ExternalLink object.

If the FormatPolicy property is set to "Inline Text" and the Title property is set to:

  • A DOM object, the formatting specified by the DOM object is ignored

  • An mlreportgen.dom.InternalLink or mlreportgen.dom.ExternalLink object, the link text is used for the title, but the title is not a link

In both cases, to format the title, use the TextFormatter property of this ModelConfiguration reporter.

If you do not specify a title, the title is the model name followed by Configuration Set. For example:

sf_car Configuration Set

Format for reporting the configuration set, specified as one of these strings or character vectors:

  • "Auto" — Formats the configuration set, components, and property values as a table or a paragraph, depending on the data type.

    Data types formatted as a table include:

    • Cell array

    • Logical array

    • Numeric array

    • MATLAB® table

    • Simulink object

    • Stateflow® object

    • Graphics object

    • MATLAB structure or structure array

    • MATLAB object or object array

    Data types formatted as a paragraph include:

    • Cell vector

    • Logical scalar or vector

    • Numeric scalar or vector

    • Character or character array

    • String

    • MATLAB structure vector

    • MATLAB object vector

    Because the configuration set and components are objects, they are formatted as tables. The property values are formatted according to the data types of the values.

  • "Table" — Formats the values in a table. Data types that by default appear as paragraphs are formatted instead as table entries. Data types that are hierarchically structured objects, such as MATLAB structures, MATLAB objects, Simulink objects, Stateflow objects, or graphics objects, can have properties that are themselves objects. In these cases, the hierarchy is flattened and the property value is a hyperlink to a table of the field or object properties. The field or property table links back to the original table.

  • "Paragraph" — Generates a description of the configuration set as paragraphs. For example:

    First paragraph is "Source Type :Model". Second paragraph is "Source Name: sf_car". Third paragraph is "sf_car Configuration Set. Configuration (Active)".

  • "Inline Text" — Generates a description of the configuration set in line with the surrounding text. For example:

    Single line of inline text, reading "sf_car Configuration Set Configuration (Active) in sf_car (Model)"

Table formatter for the tables that the ModelConfiguration reporter generates, specified as an mlreportgen.report.BaseTable object. The default value of this property is a BaseTable object with the TableStyleName property set to the ModelConfigurationTable style, which is defined in the default template for a ModelConfiguration reporter. To customize the appearance of the table, modify the properties of the default BaseTable object or replace the object with your own BaseTable object. If you add content to the Title property, the content appears in front of the table title in the generated report.

Paragraph formatter for any model configuration content that is generated as a paragraph, specified as an mlreportgen.dom.Paragraph object. The default value of this property is a Paragraph object with the StyleName property set to the ModelConfigurationParagraph style, which is defined in the default template for a ModelConfiguration reporter. To customize the appearance of the paragraph, modify the properties of the default Paragraph object or replace the object with your own Paragraph object. If you add content to the paragraph object, the content appears in front of the model configuration content in the generated report.

Text formatter for any model configuration content that is generated as inline text, specified as an mlreportgen.dom.Text object. By default, the value of this property is an empty Text object. To customize the appearance of the text, modify the properties of the default mlreportgen.dom.Text object or replace the object with a customized mlreportgen.dom.Text object. If you add content to the Text object, the content appears in front of the model configuration content in the generated report.

Maximum number of table columns in value tables, specified as a positive integer. If a property value is reported using a table and the number of columns is greater than the value of the MaxCols property, the table is sliced vertically. Slicing divides the table into multiple tables.

Maximum number of nested levels in the structured object hierarchy to report, specified as a nonnegative integer. The top level of the hierarchy is the configuration set object (Simulink.ConfigSet). Levels less than or equal to the value of DepthLimit are flattened into a sequence of interlinked tables. Levels greater than the depth limit are not reported. If you set the DepthLimit property to 0, hierarchically structured types are not expanded.

Maximum number of objects in an object hierarchy to report, specified as a positive integer.

Whether to include the configuration set title, specified as true or false.

When IncludeTitle is true, the configuration set title (the content of the Title property) is included in the:

  • Title of the configuration set property table when the FormatPolicy is "Auto" or "Table"

  • The content generated when the FormatPolicy is "Inline Text" or "Paragraph"

The configuration set title is always included in the title for the paragraph or table that contains the configuration set components, regardless of the value of the IncludeTitle property.

Whether a title includes the data type of the value that the title describes, specified as true or false.

Data Types: logical

Whether to show configuration set or component properties that have empty values, specified as a true or false.

Data Types: logical

Whether to show configuration set or component properties that use the default values, specified as true or false.

Data Types: logical

Function or expression to filter configuration set and component object properties from a report, specified as a function handle, string scalar, or character vector. Specify a function as a function handle. Specify an expression as a string scalar or character vector. If PropertyFilterFcn is empty, all properties are included in the report.

If you provide a function handle, the associated function must:

  • Take these arguments:

    • variableName — Name of the variable being reported

    • variableObject — The variable being reported

    • propertyName — Name of the property of the variable being reported

  • Return true to filter the specified property from the report, or false to include the property in the report.

For example, this code uses the PropertyFilterFcn property to prevent the display of the Name and Description properties:

import slreportgen.report.*

rpt = slreportgen.report.Report("MyReport","pdf");
open(rpt);

model = "sf_car";
load_system(model);
reporter = ModelConfiguration(model);

filterFcnHandle = @(variableName,variableObject,propertyName) ...
    (propertyName == "Name") ||  ...
    (propertyName == "Description");

reporter.PropertyFilterFcn = filterFcnHandle;
append(rpt,reporter);
close(rpt);
rptview(rpt);

If you provide a string scalar or a character vector, it must contain an expression. The expression:

  • Can use the variables variableName, variableObject, and propertyName

  • Must set the variable isFiltered to true to filter the specified property from the report, or false to include the property in the report

For example, this code uses the PropertyFilterFcn property to prevent the display of the Name and Description properties:

import slreportgen.report.*

rpt = slreportgen.report.Report("MyReport","pdf");
open(rpt);

model = "sf_car";
load_system(model);
reporter = ModelConfiguration(model);


filterStr = "isFiltered = " +...
    "strcmp(propertyName,'Name')||strcmp(propertyName,'Description');";
reporter.PropertyFilterFcn = filterStr;

append(rpt,reporter);
close(rpt);
rptview(rpt);

Format or precision used to display noninteger numeric values, specified as a string scalar, character vector, or positive integer.

Specify the format as a string scalar or a character vector. See the formatSpec argument on the sprintf reference page.

Specify the precision as a positive integer. See the precision argument on the num2str reference page.

Example: "%.2f" displays double values with two digits to the right of the decimal place.

Example: 2 displays a maximum number of two significant digits.

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.

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 source (TemplateSrc) for this reporter.

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 is converted to a LinkTarget object. The link target immediately precedes the content of this reporter in the output report.

Methods

expand all

Examples

collapse all

Use an object of the slreportgen.report.ModelConfiguration class to report on the active model configuration set.

Import the MATLAB Report and Simulink Report API packages so that you do not have to use long, fully qualified class names.

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

Create a Simulink report.

rpt = slreportgen.report.Report("MyReport","pdf");
open(rpt);

Create a chapter for the active model configuration set.

chapter = Chapter();
chapter.Title = "Active Model Configuration Set";

Load a model.

model = "sf_car";
load_system(model);

Create an slreportgen.report.ModelConfiguration object to report on the active configuration set of the model.

reporter = ModelConfiguration(model);

Append the reporter to the chapter and chapter to the report.

append(chapter,reporter);
append(rpt,chapter);

Close and view the report

close(rpt);
rptview(rpt);
Introduced in R2020b