Main Content

slreportgen.finder.DataDictionaryFinder Class

Namespace: slreportgen.finder
Superclasses: mlreportgen.finder.Finder

Find data dictionaries

Since R2020b

Description

Use an object of the slreportgen.finder.DataDictionaryFinder class to find Simulink® data dictionaries.

The slreportgen.finder.DataDictionaryFinder class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

finder = slreportgen.finder.DataDictionaryFinder creates a data dictionary finder and sets the Container property to 'MATLABPath'.

You can constrain the search by setting the properties of the finder. Use the methods of the finder to perform the search.

Note

This finder provides these options to get search results:

  • To return the search results as an array, use the find method. Add the results directly to a report or process the results in a for-loop.

  • To iterate through the results one at a time, use the hasNext and next methods in a while-loop.

Neither option has a performance advantage.

finder = slreportgen.finder.DataDictionaryFinder(searchFolder) creates a data dictionary finder and sets the Container property to the folder or folders specified by searchFolder.

finder = slreportgen.finder.DataDictionaryFinder(Name=Value) sets properties using name-value arguments. You can specify multiple name-value arguments in any order.

Properties

expand all

Folders to search for data dictionaries, specified as a string array, character vector, or cell array of character vectors. Strings and character vectors can include the * and the ** wildcards. Characters next to the ** wildcard must be file separators. For example, to find all data dictionaries in the exampleFolder folder and its subfolders, set Container to "exampleFolder\**". If Container is set to 'MATLABPath', the finder searches for data dictionaries in the current folder and all folders on the MATLAB® path.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string | cell

Data dictionary to find, specified as a character vector or string scalar. The Name property value can include the * wildcard. For example, to find all data dictionaries that begin with sldemo_fuelsys_dd, set the Name property to "sldemo_fuelsys_dd*". The name or expression specified in this property must have no file name extension or the extension .sldd.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Properties of the data dictionaries to find, specified as a cell array of name-value arguments. Use the Properties property to filter the finder results by the data dictionary properties. The finder searches the folders specified by the Container property for data dictionaries with names that match the Name property and that have the specified properties values. For data dictionary properties, see Simulink.data.Dictionary. For example, to return only the data dictionaries that have access to the base workspace, set Properties to {'HasAccessToBaseWorkspace',true}.

Attributes:

GetAccess
public
SetAccess
public

Data Types: cell

Methods

expand all

Examples

collapse all

To report on data dictionaries, create an slreportgen.DataDictionaryFinder object. Use the object properties to constrain the search and the methods to get the results.

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.finder.*
import slreportgen.report.*

Create a Simulink report and append a table of contents to the report.

rpt = slreportgen.report.Report("MyReport","html-file");
append(rpt,TableOfContents);

Create a Simulink data dictionary finder to search the entire MATLAB path.

f = DataDictionaryFinder();

Constrain the finder to find only data dictionaries that have names that contain the word control.

f.Name = "*control*";

Create a chapter for the data dictionaries.

ch = Chapter("Data Dictionaries");

For each found dictionary, create a section and append it to the chapter.

while hasNext(f)
    result = next(f);
    s = Section(result.Name);
    append(s,result);
    append(ch,s);
end

Append the chapter to the report. Close and view the report.

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

Version History

Introduced in R2020b