Main Content

slreportgen.finder.ChartDiagramFinder class

Package: slreportgen.finder
Superclasses: slreportgen.finder.DiagramFinder

Create Stateflow chart finder

Description

Finds Stateflow® charts.

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

Creation

Description

example

finder = ChartDiagramFinder(container) creates a finder that finds by default all uncommented Stateflow chart diagrams in the specified container. To constrain the search to specific types of diagrams, use the properties of this 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.

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

Input Arguments

expand all

See Container property.

Properties

expand all

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

  • Handle of a Stateflow chart block

  • Path to a Stateflow chart block

  • Stateflow chart ID

  • Stateflow chart object

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

Choice to search masked subsystems, specified as a logical. If this property is true, the finder searches masked Subsystem blocks in the diagram container. It searches to the specified SearchDepth and includes the diagrams it finds in the search results.

Choice to search referenced models, specified as a logical. If this property is true, the finder searches models referenced in the diagram container. It searches to the specified SearchDepth and includes the diagrams it finds in the search results.

Choice to search Simulink library links, specified as a logical. If both this property and IncludeMaskedSubsystems are true, the finder searches links in the diagram container to both Subsystem and masked Subsystem blocks in Simulink libraries. It searches to the specified SearchDepth and includes the diagrams it finds in the search results. If this property is true, but IncludeMaskedSubsystems is false, the finder searches only links to Subsystem blocks in Simulink libraries.

Choice to search user library links, specified as a logical. If this property is true and the IncludeMaskedSubsystems property is true, the finder searches links in the diagram container to Subsystem and masked Subsystem blocks in user libraries. It searches to the specified SearchDepth and includes the diagrams it finds in the search results. If this property is true, but the IncludeMaskedSubsystems property is false, the finder searches only links to Subsystem blocks in user libraries.

Choice to include commented-out charts in the search results, specified as a logical. If false, commented-out charts are excluded from the search results.

Variants to search for diagrams, specified as a string or character vector. The default value is Active. Valid values are:

  • All — All variants

  • Active — Only active variants

  • ActivePlusCode — All active variants and code variants

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.

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

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

Whether to close models, specified as true or false. If 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.

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.

Methods

expand all

Examples

collapse all

Create a report that includes images of all Stateflow charts in the sldemo_fuelsys model. Use a separate chapter for each chart.

Run the following command to access the supporting files used in this example.

openExample('rptgenext/SimulinkReportGeneratorFilesExample');
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
 
model_name = "slrgex_fuelsys";
load_system(model_name);
rpt = slreportgen.report.Report("output","pdf");

add(rpt, TitlePage(Title=sprintf("%s Charts",model_name)));
add(rpt, TableOfContents);
chapter = Chapter("Root System");
add(chapter, Diagram(model_name));
add(rpt,chapter);

chapter = Chapter("Charts");
finder = ChartDiagramFinder(model_name); 
results = find(finder);
for result = results
    section = Section(Title=result.Name);
    add(section,result);
    add(chapter,section);
end
add(rpt, chapter);

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

Version History

Introduced in R2017b