Main Content

getDiagramReporter

Class: slreportgen.finder.BlockResult
Namespace: slreportgen.finder

Returns Diagram reporter for this block result

Syntax

reporter = getDiagramReporter(result)

Description

reporter = getDiagramReporter(result) returns a diagram reporter if the block result contains a subsystem or chart block. The reporter generates a snapshot of the block's diagram or chart, respectively. If the block result contains any other type of block, this method returns empty, []. To include a diagram of the subsystem or chart block search result in a report, add this reporter to the report, either directly or via a Chapter or Section reporter.

Input Arguments

expand all

BlockResult object, which is the output of the slreportgen.finder.BlockFinder class.

Output Arguments

expand all

Diagram reporter object, returned as an slreportgen.report.Diagram or empty, []. If the result contains a subsystem or chart block, this result returns a Diagram reporter that generates a snapshot of the block's block diagram or chart, respectively. Otherwise, it returns empty, [].

Examples

Add Block Diagram to Report

Add a subsystem snapshot and property table of the Controller block subsystem of the f14 model to a report.

model_name = 'f14';
openExample(model_name)
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.report.*

rpt = slreportgen.report.Report('output','pdf');
chapter = Chapter();
chapter.Title = 'Block Diagram Reporter Example';

blkFinder = BlockFinder(model_name);
blocks = find(blkFinder);
for block = blocks
    if block.Name == "Controller"
       rptr = getDiagramReporter(block);
       section = Section(Title=strrep(block.Name, newline,' '));
       add(section,rptr);
       add(section,block);
       add(chapter,section);
    end
end
add(rpt,chapter)
rptview(rpt)

Version History

Introduced in R2018b