Main Content

slreportgen.report.DataDictionary class

Package: slreportgen.report

Simulink data dictionary reporter

Description

Use an object of the slreportgen.report.DataDictionary class to report on a Simulink® data dictionary. Create a DataDictionary object to report on a specific data dictionary. Alternatively, use an slreportgen.finder.DataDictionaryFinder object to find data dictionaries and use the getReporter method of an slreportgen.finder.DataDictionaryResult object to return the reporter for the result.

Note

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

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

reporter = slreportgen.report.DataDictionary() creates a DataDictionary reporter object based on the default template. Use the reporter properties to specify a data dictionary and report options. You must specify the data dictionary to report. Adding an empty data dictionary reporter object to a report produces an error.

example

reporter = slreportgen.report.DataDictionary(dictionaryName) creates a DataDictionary reporter object and sets the Dictionary property to the specified data dictionary. Use the reporter properties to specify report options.

reporter = slreportgen.report.DataDictionary(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

Data dictionary to report, specified as a character vector or string scalar that contains the file name of a dictionary on the MATLAB® path or the path and file name of a data dictionary. The path can be relative or absolute.

Example: "sldemo_fuelsys_dd.sldd"

Example: "myDictionaries/myDataDictionary.sldd"

Properties to report for each data dictionary entry in the summaries table, specified as a string array or cell array of character vectors. Valid properties are:

  • Name

  • Value

  • Class

  • LastModified

  • LastModifiedBy

  • Status

  • DataSource

The Value entry contains the value if the data type is numeric scalar, logical scalar, string scalar, or character vector. Otherwise, the Value entry is See details.

Example: ["Name" "Value" "Class" "LastModified" "LastModifiedBy" "Status" "DataSource"]

Example: {'Name' 'Value' 'Class'}

Whether to report the Design Data section of the data dictionary, specified as true or false.

Data Types: logical

Whether to report the Configurations section of the data dictionary, specified as true or false.

Data Types: logical

Whether to report the Other Data section of the data dictionary, specified as true or false.

Data Types: logical

Whether to include the dictionaries that are referenced by the dictionary that this reporter reports, specified as true or false. The ReferencedDictionaryPolicy property determines how referenced dictionaries are reported.

Data Types: logical

Display policy for reporting a referenced dictionary, specified as one of these values:

  • "SameTable" — Report referenced dictionary entries in the same table as the main dictionary entries. The details are displayed in the order that they appear in the summary table. This value is the default value.

  • "SeparateTables" — Make a separate table for each referenced dictionary. The referenced dictionary summary tables are displayed immediately after the main summary table. The referenced dictionary details reporters are displayed after the main dictionary details reporters.

  • "List" — Report a list of referenced dictionaries. The list items link to separate data dictionary reporters. The links work only if you add the reporters for the referenced dictionaries to this report. The list appears in the Design Data section, immediately after the dictionary summary table. The dictionary summary table does not include the referenced dictionary entries. The details are not reported for the referenced dictionary entries.

Data dictionary entry filter, specified as a function handle, string scalar, or character vector. If you do not provide EntryFilterFcn, all entries are included in the report.

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

  • Take these arguments:

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

For example, this code uses the EntryFilterFcn property to prevent reporting of entries that are Simulink.Parameter objects:

rpt = slreportgen.report.Report("MyReport","pdf");
ddPath = which("sldemo_fuelsys_dd.sldd");

ch = mlreportgen.report.Chapter("sldemo_fuelsys_dd.sldd");
rptr = slreportgen.report.DataDictionary(ddPath);

filterFcnHandle = @(entryObject, entryValue) ...
    isa(entryValue,"Simulink.Parameter");
rptr.EntryFilterFcn = filterFcnHandle;

append(ch,rptr);
append(rpt,ch);

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 entryObject and entryValue

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

For example, this code uses the EntryFilterFcn property to prevent reporting of entries that are Simulink.Bus objects:

rpt = slreportgen.report.Report("MyReport","pdf");
ddPath = which("sldemo_fuelsys_dd.sldd");

ch = mlreportgen.report.Chapter("sldemo_fuelsys_dd.sldd");
rptr = slreportgen.report.DataDictionary(ddPath);
filterStr = "isFiltered = isa(entryValue,'Simulink.Bus');";
rptr.EntryFilterFcn = filterStr;

append(ch,rptr);
append(rpt,ch);

close(rpt);
rptview(rpt);

Formatter for the entry summary tables, specified as an mlreportgen.report.BaseTable object. The default value of this property is a BaseTable object with the TableStyleName property set to the DataDictionaryTable style which is defined in the default template for a DataDictionary reporter. To customize the appearance of the table, modify the properties of the default BaseTable object or replace the object with a customized BaseTable reporter. If you add content to the Title property, the content appears in front of the table title in the generated report.

Formatter for the entry details, specified as an mlreportgen.report.MATLABVariable object. The default value of this property is a MATLABVariable object with default property values. To customize the appearance of the entry details, modify the properties of the default MATLABVariable object or replace the object with your own MATLABVariable reporter. The Variable, Location, and LinkTarget properties of the MATLABVariable reporter are ignored.

List formatter for a referenced dictionary list, specified as an mlreportgen.dom.UnorderedList object or mlreportgen.dom.OrderedList object. The list formatter is used when the ReferencedDictionaryPolicy property is set to "List". The UnorderedList or OrderedList object must not contain list items.

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

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.DataDictionary class to report on a Simulink data dictionary.

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

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

Create a Simulink report.

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

Specify the path to the data dictionary used by the model sldemo_fuelsys_dd.

ddPath = "sldemo_fuelsys_dd.sldd";

Create a chapter for the data dictionary information.

ch = Chapter("sldemo_fuelsys_dd.sldd");

Create a reporter for the data dictionary.

rptr = DataDictionary(ddPath);

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

append(ch,rptr);
append(rpt,ch);

Close and view the report.

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