Main Content

slreportgen.finder.DiagramElementResult Class

R2026b

Namespace: slreportgen.finder

Create diagram element finder result object

Description

Diagram element search result object for an element in a Simulink® or Stateflow® diagram.

When you add a DiagramElementResult object to a report or reporter, the object uses its getReporter method to generate a properties table for the element. If the element contains a diagram such as a subsystem block or a Stateflow chart, use the getDiagramReporter method to obtain a reporter that generates a snapshot of that diagram.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

result = DiagramElementResult(elem) creates a search result object for a diagram element. The result object contains the specified Simulink or Stateflow diagram element.

Note

The find methods of diagram element finders create and return instances of this slreportgen.finder.DiagramElementResult object. You do not need to create instances yourself.

example

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

Input Arguments

expand all

Simulink or Stateflow diagram element, specified as a path or handle to the element.

Properties

expand all

Public Properties

Additional user-defined information to add to the result, specified as any value.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Protected Properties

This read-only property contains a handle to the diagram element returned in this result.

This read-only property specifies the name of the diagram element returned in this result.

This read-only property specifies the type of the diagram element returned in this result.

Example: "Simulink.BlockDiagram"

This read-only property returns the path of the diagram that contains the element returned in this result.

Methods

expand all

Examples

collapse all

Find the Simulink Function subsystems in the sf_car model. For each slreportgen.finder.DiagramElementResult object, call the getDiagramReporter method to get the subsystem diagram and add it to a report.

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

model = "sf_car";
openExample(model)

rpt = slreportgen.report.Report("output","pdf");
chapter = Chapter();
chapter.Title = "Diagram Element Result Example";

Find the diagrams in the model.

diagFinder = DiagramFinder(model);
diagrams = find(diagFinder);
for diag = diagrams

Find the Simulink Function subsystems in the current diagram.

    elemFinder = DiagramElementFinder(diag);
    elemFinder.Types = "slfunction";
    elems = find(elemFinder);
    for elem = elems
        section = ...
            Section(Title=mlreportgen.utils.normalizeString(elem.Name));

Get the diagram reporter from the result and add it to the section.

        rptr = getDiagramReporter(elem);
        if ~isempty(rptr)
            add(section,rptr)
        end
        add(section,elem);
        add(chapter,section);
    end
end

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

Report chapter showing the snapshot and property table of the Simulink Function subsystems in the sf_car model.

Version History

Introduced in R2017b