Main Content

slreportgen.finder.DiagramElementResult class

Package: slreportgen.finder
Superclasses: mlreportgen.finder.Result

Create diagram element finder result object


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


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


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.

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

Input Arguments

expand all

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


expand all

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.

Additional information to add to this result. You can set it to any type of value.


Public Methods

getDefaultSummaryPropertiespropList = getDefaultSummaryProperties(resultObject,TypeSpecificProperties) returns the list of finder result class properties that are included by default in a summary table.
getDefaultSummaryTableTitletableTitle = getDefaultSummaryTableTitle(resultObject,TypeSpecificTitle) returns the default title for a summary table for a finder result object of type resultObject.

propVals = getPropertyValues(resultObject,propNames) returns the values of the properties specified in propNames in a cell array. Access the properties of the result object or the diagram element represented by the finder result object by specifying the required property names in propNames.

getReporterLinkTargetIDtargetID = getReporterLinkTargetID(resultObject) returns the link target ID of the reporter associated with the finder result object. Use the link target ID to add a hyperlink to the reporter from any part of the report.

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects.


collapse all

The slrgex_sf_car model uses a Simulink Function, which is a function that uses a Simulink subsystem to compute its outputs from its inputs. This example finds the diagrams in the model and for each diagram uses an slreportgen.DiagramElementFinder object to find the Simulink Function subsystems. For each slreportgen.DiagramElementResult object returned by the finder, the example uses the Name property value as a section title and calls the getDiagramReporter method to return the subsystem diagram to add to the section.

import slreportgen.finder.*

model = "slrgex_sf_car";

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

% Find all diagrams in the model
diagFinder = DiagramFinder(model);
diagrams = find(diagFinder);
for diag = diagrams
    % Find all 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)


Version History

Introduced in R2017b