Main Content

systemcomposer.rptgen.finder.ComponentFinder class

Package: systemcomposer.rptgen.finder
Superclasses: mlreportgen.finder.Finder (MATLAB Report Generator)

Find components

Description

The systemcomposer.rptgen.finder.ComponentFinder class searches for information about all the components in a System Composer™ architecture model.

Creation

finder = ComponentFinder(Container) creates a finder that finds all components in a model that meet the Query property.

Note

This finder provides two ways to get search results:

  1. 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.

  2. 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.

Properties

expand all

Architecture model file name without the .slx extension, specified as a string.

Example: f = ComponentFinder("ArchModel")

Data Types: string

Query to find components, specified as a systemcomposer.query.Constraint object.

Attributes:

GetAccess
public
SetAccess
public

Option to recursively search model or to only search a specific layer, specified as 1 (true) to recursively search or 0 (false) to only search the specific layer.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Option to search for reference architectures, specified as a logical.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

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: f.Properties = {'Gain','5'}

Data Types: char

Methods

expand all

Examples

collapse all

Use the ComponentFinder and ComponentResult classes to generate a report.

import systemcomposer.rptgen.finder.*
import mlreportgen.report.*
import slreportgen.report.*
import systemcomposer.query.*

rpt = slreportgen.report.Report(output="ComponentFinderReport",...
CompileModelBeforeReporting=false);
add(rpt,TitlePage("Title","Components"));
add(rpt,TableOfContents);

componentFinder = ComponentFinder("mTestModel");
componentFinder.Query = AnyComponent;
  
chapter = Chapter("Components in mTestModel");
  
while hasNext(componentFinder)
    componentResult = next(componentFinder);
    sect = Section(componentResult.Name);
    add(sect,componentResult);
    add(chapter,sect);
end

add(rpt,chapter);
close(rpt);
rptview(rpt);

Version History

Introduced in R2022b