Main Content

slreportgen.finder.SignalFinder class

Package: slreportgen.finder

Find signals used by model or block

Since R2021a

Description

Use an object of the slreportgen.finder.SignalFinder class to find signals used by a model or block.

Signals are the outputs of dynamic systems that are represented by blocks in a Simulink diagram and by the diagram itself. To find unique signals in a system, the signal finder searches for block output ports. When a block or subsystem is searched, the results represent the output ports of the block or subsystem, as well as the output ports of the blocks whose output signals feed into the block or subsystem. When a model is searched, the results represent the output ports of the model Inport blocks and the block output ports that are connected to the model Outport blocks.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

example

finder = slreportgen.finder.SignalFinder(container) creates a SignalFinder object and sets the Container property to the model or block specified by container. Use the SignalFinder properties to:

  • Constrain the search to the types of signals found, such as input, output, or internal signals.

  • Specify the number of levels to search in a model.

Use the SignalFinder methods to perform the search.

Note

This finder provides two ways 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.SignalFinder(Name=Value) sets the SignalFinder object properties using name-value pairs. You can specify multiple name-value pair arguments in any order.

Properties

expand all

Model or block to search for signals, specified as one of the following values:

  • A string scalar or character vector that contains the name of a model or block

Whether to find the signals used as input data to the container model or block, specified as true or false. If Container is a model, the input signal results represent the output ports of any Inport blocks in the top level of the model. If Container is a block, the input signal results represent the output ports of the blocks that feed into the container block input ports.

Whether to find signals output by the container model or block, specified as true or false. If Container is a model, the output signal results represent the output ports of blocks that feed into Outport blocks in the top level of the model. If Container is a block, the output signal results represent the output ports of the block.

Whether to find block control signals, specified as true or false. This property applies only when Container is a block, such as a Subsystem or Model block, that has a control port. Control signals control the execution of a block. Control signal results represent the output ports of blocks that feed into a block control port, such as the enable, trigger, or reset port. If Container is a model, any signals that control the execution of blocks in the model are reported as internal signals.

Whether to find internal signals, specified as true or false. Internal signals are not used as input, output, or control signals for a model or subsystem. This property applies only if the Container is a model or subsystem. Internal signal results represent the output ports of all blocks in the system, except for the output ports of Inport blocks and output ports that feed into Outport blocks.

Whether to find signals output by virtual blocks, specified as true or false.

If this property is true, signal results can represent ports of virtual blocks, such as virtual Subsystem blocks.

If this property is false, signal results represent only output ports of nonvirtual blocks. Input and control signals are traced to the nonvirtual blocks that output the signal. If the model or block specified by the Container property is virtual, output ports of the model or block are traced to their nonvirtual sources.

Whether to find signals without a name, specified as true or false.

Number of levels to search for internal signals in the model or subsystem, specified as one of these values:

  • 1 — Search level one (top level) only.

  • 0 — Search only for signals that are related to the ports of the model or block.

  • An integer n that is greater than one — Search the specified number of levels. The results are sorted from level one (top) to level n.

  • inf — Search all levels.

See IncludeInternalSignals.

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

ValueDescription
"depth"Sort results by depth in the model hierarchy. The first result in the sorted list belongs to the object that is highest in the hierarchy. For example, a model and its subsystems are sorted in the order: myModel, myModel/subsystem1, myModel/subsystem1/nestedSubststem.
"alphabetical"Sort results alphabetically by name.
"systemAlpha"Sort results alphabetically by parent system name.

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

Example: {'CompiledPortDataType','int8'}

Methods

expand all

Examples

collapse all

This example creates a report that includes information about signals in a model by using an slreportgen.finder.SignalFinder object. The example sets the finder properties so that signals without names are excluded and internal signals are included.

Import the MATLAB Report API and Simulink Finder API packages so that you do not have to use long, fully qualified class names.

import mlreportgen.report.*
import slreportgen.finder.*

Create a Simulink report.

rpt = slreportgen.report.Report("MyReport","pdf");

Create a chapter for the signal information.

chapter = Chapter();
chapter.Title = "Named Signals";

Load a model.

model_name = "slrgex_vdp";
load_system(model_name);

Create a signal finder and set the properties to exclude signals without names and include internal signals.

finder = SignalFinder(model_name);
finder.IncludeUnnamedSignals = false;
finder.IncludeInternalSignals = true;

Find the signals and add the results to the chapter.

results = find(finder);
append(chapter,results);

Add the chapter to the report.

append(rpt,chapter);

Close and view the report.

close(rpt);
rptview(rpt);

Version History

Introduced in R2021a