Main Content

slreportgen.finder.SystemDiagramFinder Class

Namespace: slreportgen.finder
Superclasses: slreportgen.finder.DiagramFinder

Create block diagram finder

Description

Create Simulink® block diagram finder.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

finder = SystemDiagramFinder(container) creates a finder that finds Simulink block diagrams in the specified container, which can be a Simulink model or subsystem. To constrain the search to only include specific types of models or subsystems, use the properties of the finder.

Note

This finder can operate in either find or iterator mode. In find mode, use its find method to return the results of a search as an array of results. In iterator mode, use its hasNext and next methods to return the results of a search one-by-one. When searching in models that have many model references, use iterator mode. Iterator mode closes a model after compiling and searching it, whereas find mode keeps all the models that it searches open. Having many open models can consume all system memory and slow report generation. Iterator mode is slower than find mode, so use find mode to search models that reference few or no other models.

example

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

Input Arguments

expand all

See Container property.

Properties

expand all

System container in which to search, specified as one of these values:

  • Handle of a Simulink model or subsystem

  • Path to a Simulink model or subsystem

Attributes:

GetAccess
public
SetAccess
public

Depth of system search, specified as Inf or a positive integer. SearchDepth specifies how many levels deep to search a container for diagrams or charts. To search all levels, use Inf.

Attributes:

GetAccess
public
SetAccess
public

Data Types: double

Whether to search masked subsystems, specified as a logical 1 (true) or 0 (false). When you specify:

  • 1 (true) — Search masked Subsystem blocks in the container. It searches to the specified SearchDepth and includes the diagrams or charts it finds in the search results.

  • 0 (false) — Do not search masked subsystems.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Whether to search referenced models, specified as a logical 1 (true) or 0 (false). When you specify:

  • 1 (true) — The finder searches models referenced in the container. It searches to the specified SearchDepth and includes the diagrams or charts it finds in the search results.

  • 0 (false) — Do not search model references.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Whether to search Simulink library links, specified as a logical 1 (true) or 0 (false). When you specify:.

  • 1 (true) — Search Simulink library links. If the IncludeMaskedSubsystems property is also true, the finder searches links in the container to subsystem and masked subsystem blocks in Simulink libraries. The finder searches to the specified SearchDepth and includes the diagrams or charts it finds in the search results. If the IncludeMaskedSubsystems property is false, the finder searches only links to subsystem blocks in Simulink libraries.

  • 0 (false) — Do not search Simulink library links.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Whether to search user library links, specified as a logical 1 (true) or 0 (false). When you specify:

  • 1 (true) — Search user library links. If the IncludeMaskedSubsystems property is also true, the finder searches links in the container to subsystem and masked subsystem blocks in user libraries. It searches to the specified SearchDepth and includes the diagrams or charts it finds in the search results. If the IncludeMaskedSubsystems property is false, the finder searches only links to subsystem blocks in user libraries.

  • 0 (false) — Do not search user library links.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Whether to include the root diagram in the search results, specified as a logical 1 (true) or 0 (false). When you specify:.

  • 1 (true) — If true and the top-level diagram container is a model, the model block diagram is included in the search results.

  • 0 (false) — Exclude the model block diagram from the search results.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Whether to include commented-out diagrams or charts in the search results, specified as a logical 1 (true) or 0 (false). When you specify:

  • 1 (true) — Include commented-out diagrams or charts in the search results.

  • 0 (false) — Exclude commented-out diagrams or charts from the search results.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Whether to include variants to search for diagrams, specified as one of these values:

ValueDescription
"Active"Active variants
"All"All variants
"ActivePlusCode"Active variants and code variants

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Sorting method for finder results, specified as one of these values:

ValueDescription
"none"Do not sort results.
"alphabetical"Sort results alphabetically by name.
"numBlocks"Sort results by number of blocks in the system. The first block in the sorted list contains the highest number of blocks.
"depth"Sort results by depth in the model hierarchy. The first system in the sorted list is the system that is highest in the hierarchy. For example, a model and its subsystems are sorted in the order: myModel, myModel/subsystem1, myModel/subsystem1/nestedSubststem.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Properties of objects to find, specified as a cell array of name-value arguments. The finder returns only objects that have the specified properties with the specified values.

Example: finder.Properties = {'Gain','5'}

Attributes:

GetAccess
public
SetAccess
public

Data Types: cell

Whether to close models, specified as a logical 1 (true) or 0 (false). When you specify:

  • 1 (true) — The next method of the finder closes the currently open model before moving to the next model to search. Closing models prevents excessive consumption of memory when searching a model that references many models.

  • 0 (false) — Leave models open while searching.

Note

The find method of the finder ignores this property and leaves all referenced models open. For this reason, you should not use the find method to search models with many model references.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Methods

expand all

Examples

collapse all

Create a report that finds block diagrams in the sf_car model.

import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
model_name = "sf_car";
load_system(model_name);

rpt = slreportgen.report.Report("output","pdf");
add(rpt, TitlePage(Title=model_name +" Systems"));
add(rpt,TableOfContents);
finder = SystemDiagramFinder(model_name); 
results = find(finder);
for result = results
     chapter = Chapter(...
         Title=mlreportgen.utils.normalizeString(result.Name));
     add(chapter,result);
     add(rpt,chapter);
end

close(rpt);
close_system(model_name);
rptview(rpt);

Version History

Introduced in R2017b