Main Content

systemcomposer.rptgen.finder.ConnectorFinder class

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

Find connectors

Description

The systemcomposer.rptgen.finder.ConnectorFinder class searches for information about all the connectors in a given System Composer™ architecture model.

Creation

finder = ConnectorFinder(Container) creates a finder that finds all connectors in a component or on an architecture specified by the Filter property. The component is defined by the ComponentName 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 = ConnectorFinder("ArchModel")

Data Types: string

Filter to find connectors, specified as "Component" to find connectors in a component or "Architecture" to find connectors on an architecture.

Attributes:

GetAccess
public
SetAccess
public

Data Types: string

Component to find connectors in, specified as a string of the full path.

Example: f.ComponentName = "mTestModel/Component1"

Attributes:

GetAccess
public
SetAccess
public

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

Data Types: char

Methods

expand all

Examples

collapse all

Use the ConnectorFinder and ConnectorResult classes to generate a report.

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

scExampleSmallUAV
model_name = "scExampleSmallUAVModel";
model = systemcomposer.loadModel(model_name);
rpt = slreportgen.report.Report(output="ConnectorFinderReport",...
CompileModelBeforeReporting=false);
add(rpt,TitlePage("Title",sprintf('Connectors in %s Model',model_name)));
add(rpt,TableOfContents);

connectorFinder = ConnectorFinder(model_name);
connectorFinder.ComponentName = "scExampleSmallUAVModel/Flight Support Components/GPS Module";
connectorFinder.Filter = "Component";
chapter = Chapter("Title","Connectors");
while hasNext(connectorFinder)
    connector = next(connectorFinder);
    sect = Section("Title",connector.Name);
    add(sect,connector);
    add(chapter,sect);
end

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

Version History

Introduced in R2022b