Main Content

slreportgen.report.ModelConfiguration Class

Namespace: slreportgen.report
Superclasses: slreportgen.report.Reporter

Model configuration set reporter

Since R2020b

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.

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

example

reporter = slreportgen.report.ModelConfiguration(Name=Value) sets the reporter properties using name-value arguments. You can specify multiple name-value arguments in any order.

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

Configuration set and component object properties to filter, specified as a function handle, string scalar, or character vector. If PropertyFilterFcn is empty, the report includes all configuration properties.

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

  • Take these arguments:

    • variableName — Name of the variable to report

    • variableObject — The variable to report

    • propertyName — Name of the property of the variable to report

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

For example, see Filter Configuration Properties by Using Function Handles.

If you specify 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, see Filter Configuration Properties by Using String Scalars.

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 this reporter uses or whose template library contains the template for this reporter

  • Document Object Model (DOM) document or document part whose template this reporter uses 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 reporter. 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
NonCopyable
true

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

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.

Attributes:

GetAccess
public
SetAccess
public

Methods

expand all

Examples

collapse all

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

Create a Simulink report.

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

Create a chapter for the active model configuration set.

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

Load the model.

model_name = "sf_car";
load_system(model_name);

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

reporter = slreportgen.report.ModelConfiguration(model_name);

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);

This example shows how to filter the Name and Description properties in the active model configuration set by specifying the PropertyFilterFcn property as a function handle.

Create a Simulink report.

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

Create a chapter for the active model configuration set.

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

Load the model.

model_name = "sf_car";
load_system(model_name);

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

reporter = slreportgen.report.ModelConfiguration(model_name);

Specify the PropertyFilterFcn property as a function handle named filterFcnHandle that filters the Name and Description properties.

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

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);

This example shows how to filter the Name and Description properties in the active model configuration set by specifying the PropertyFilterFcn property as a string.

Create a Simulink report.

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

Create a chapter for the active model configuration set.

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

Load the model.

model_name = "sf_car";
load_system(model_name);

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

reporter = slreportgen.report.ModelConfiguration(model_name);

Specify the PropertyFilterFcn property as a string that filters the Name and Description properties. The string must contain an expression that sets the value of a variable named isFiltered.

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

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);

Algorithms

This reporter only includes the configuration parameters that are loaded when you generate the report. By default, when you open a model, Simulink loads the Simulink configuration parameters and the set configuration parameters associated with other products. For example, the Simulink Check™ configuration parameter Show Model Advisor edit-time checks is not loaded until you set it. To include the parameters that belong to other products that do not load by default, manually set the parameters in your model before generating the report.

Version History

Introduced in R2020b