slreportgen.report.ElementDiagram class
Package: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Create a Simulink® or Stateflow® element diagram reporter. When added to a report, the
ElementDiagram
reporter creates a snapshot of an element. The reporter adds
the snapshot to the report in the form of an image with a caption. Use the Source property to specify the
desired element.
Note
To use an ElementDiagram
reporter in a report, you must create the
report using the slreportgen.report.Report
class.
The slreportgen.report.ElementDiagram
class is a handle
class.
Creation
Description
creates an
empty element diagram reporter. Set its properties to capture a Simulink or Stateflow element snapshot.diagram
= ElementDiagram()
creates a diagram reporter for an element of a block diagram or chart specified by
diagram
= ElementDiagram(source
)source
. Adding this reporter to a report creates a snapshot of
the element's diagram and adds the snapshot, with a caption, to the report. The snapshot
image file is stored in the report's temporary folder. When the report is closed, the
image file is copied into the report and the temporary folder is deleted. To prevent the
deletion, use the Debug
property of the report. See mlreportgen.report.Report
.
Input Arguments
source
— Diagram element source
character vector | string scalar | handle | object | slreportgen.finder.DiagramElementResult
object
See the Source property.
Properties
Source
— Diagram element source
character vector | string scalar | handle | object | slreportgen.finder.DiagramElementResult
object
Diagram element source, specified as one of these values:
Character vector or string scalar that contains the path to a Simulink block or Stateflow chart block
Handle to a Simulink block or Stateflow chart block
Stateflow object
Simulink Identifier (SID) of a block, annotation, or Stateflow object
Note
Simulink.Port
objects are not valid sources for this
reporter.
Snapshot
— Snapshot reporter
mlreportgen.report.FormalImage
object
Snapshot reporter, set by default to an object of the
mlreportgen.report.FormalImage
class. You do not need to set this
property yourself. The FormalImage
object adds the element diagram
snapshot to a report. To control the size of the snapshot, set its
mlreportgen.report.FormalImage
properties.
SnapshotFormat
— Snapshot image format
'svg'
(default) | ...
Snapshot image format, specified as a character vector or string scalar. Supported formats are:
'bmp'
— Bitmap image.'gif'
— Graphics Interchange format.'jpg'
— JPEG image.'png'
— PNG image.'emf'
— Enhanced metafile, supported only in DOCX output on Windows® platforms.'svg'
— Scalable Vector Graphics.'tif'
— Tag Image File format, not supported in HTML output.'pdf'
— PDF image.
See Version History.
Scaling
— Options for scaling a diagram element image
string | character vector
Options for scaling a diagram element image, specified as a string or character vector. Valid scaling options are:
auto
— For PDF or Word (docx
) output,auto
scales the element image to fit on a page while maintaining its aspect ratio. First, the element image is scaled to the page width. If the image height exceeds the page height, the image is again scaled down. This additional scaling ensures that the image fits the current page with a 1" margin. The margin allows space for a caption. Scaling does not apply to HTML output.custom
— Sets the element image height and width to the values of this reporter'sHeight
andWidth
properties.zoom
— Enlarges or reduces the element image size to the percent value specified by this reporter'sZoom
property. To specify the maximum image height and maximum image width, use theMaxHeight
andMaxWidth
properties, respectively.
Note
A java.lang.OutOfMemoryError
can occur when either of these
combinations of property settings occur:
Scaling
set tozoom
, andZoom
,MaxHeight
, andMaxWidth
properties set to large valuesScaling
set tocustom
, andHeight
andWidth
properties set to large values
To avoid this error, for zoom Scaling
, use smaller
Zoom
, MaxHeight
, and
MaxWidth
property values. For custom
Scaling
, use smaller Height
and
Width
property values. Using smaller values ensures that the
diagram fits on the page.
Height
— Height of diagram element
string
Height to set diagram element image, specified as a string. This property applies
only if this reporter's Scaling
property is set to
custom
.
The Height
format is valueUnits, where
Units is an abbreviation for the height units and
value is the number of units. The table shows the valid
Units abbreviations.
Units | Units Abbreviation |
---|---|
pixels | px |
centimeters | cm |
inches | in |
millimeters | mm |
picas | pc |
points | pt |
Width
— Width of diagram element image
string
Width to set diagram element image, specified as a string. This property applies
only if this reporter's Scaling
property is set to
custom
.
The Width
format is valueUnits, where
Units is an abbreviation for the height units and
value is the number of units. See the Height
property for a table of valid Units abbreviations.
Zoom
— Amount to zoom diagram element image
string
Amount to zoom the diagram element image, specified as a string. The
Zoom
format is value%, where
value is the percentage by which the diagram element image is
enlarged or reduced.
MaxHeight
— Maximum height for zoom scaling
string
Maximum height for zoom scaling, specified as a string. This property applies only
if this reporter's Scaling
property is set to
zoom
. The MaxHeight
format is
valueUnits, where Units is an abbreviation for
the height units and value is the number of units. See this
reporter's Height
property for a table of valid
Units abbreviations.
MaxWidth
— Maximum width for zoom scaling
string
Maximum width for zoom scaling, specified as a string. This property applies only if
this reporter's Scaling
property is set to zoom
.
The MaxWidth
format is valueUnits, where
Units is an abbreviation for the height units and
value is the number of units. See this reporter's
Height
property for a table of valid Units
abbreviations.
TemplateSrc
— Source of template for this reporter
[]
(default) | character vector | string scalar | reporter or report | DOM document or document part
Source of the template for this reporter, specified as one of these options:
Character vector or string scalar that specifies the path of the file that contains the template for this reporter
Reporter or report whose template is used for this reporter or whose template library contains the template for this reporter
DOM document or document part whose template is used for this reporter or whose template library contains the template for this reporter
The specified template must be the same type as the report to which this
reporter is appended. For example, for a Microsoft® Word report, TemplateSrc
must be a Word reporter template. If
the TemplateSrc
property is empty, this reporter uses the default
reporter template for the output type of the report.
TemplateName
— Name of template for this reporter
character vector | string scalar
Name of template for this reporter, specified as a character vector or string scalar.
The template for this reporter must be in the template library of the template source
(TemplateSrc
) for this reporter.
LinkTarget
— Hyperlink target for this reporter
[]
(default) | character vector | string scalar | mlreportgen.dom.LinkTarget
object
Hyperlink target for this reporter, specified as a character vector or string scalar
that specifies the link target ID or as an mlreportgen.dom.LinkTarget
object. A character vector or string scalar
value is converted to a LinkTarget
object. The link target immediately
precedes the content of this reporter in the output report.
Methods
Public Methods
slreportgen.report.ElementDiagram.createTemplate | Create element diagram template |
slreportgen.report.ElementDiagram.customizeReporter | Create custom element diagram reporter class |
slreportgen.report.ElementDiagram.getClassFolder | Element diagram class definition file location |
getSnapshotImage | Element diagram snapshot image file location |
copy | Create copy of a Simulink reporter object and make deep copies of certain property values |
getImpl | Get implementation of reporter |
Examples
Add Element Diagram and Caption
import slreportgen.report.* import mlreportgen.report.* load_system('f14') rpt = slreportgen.report.Report("output","pdf"); open(rpt) chap = Chapter(); chap.Title = "Element Diagram Reporter Example"; diag = ElementDiagram("f14/Actuator Model"); diag.Snapshot.Caption = "f14 Simulink Model - Actuator Model block"; add(chap,diag) add(rpt,chap) close(rpt) rptview(rpt)
Add Element Diagrams and Property Tables
load_system('f14') modelsys = "f14/Aircraft Dynamics Model"; rpt = slreportgen.report.Report("output","pdf"); open(rpt) chapter = mlreportgen.report.Chapter(); chapter.Title = "Element Snapshots"; diag = slreportgen.report.ElementDiagram(modelsys); add (chapter,diag) blkfinder = slreportgen.finder.BlockFinder(modelsys); blks = find(blkfinder); for blk = blks blkDiag = slreportgen.report.ElementDiagram... (blk.Object); blkDiag.Snapshot.Caption = strcat(blk.DiagramPath,... "/", blk.Name); add(chapter,blkDiag) % Add diagram element image add(chapter,blk) % Add property table end add(rpt,chapter) close(rpt) rptview(rpt)
Version History
Introduced in R2018bR2019b: Default value of SnapshotFormat
is 'svg'
for all report types
Starting in R2019b, Scalable Vector Graphics (SVG) images are supported for Word reports. For
all report types (HTML, PDF, and Word), the default value of the
SnapshotFormat
property is 'svg'
and a value of
'auto'
indicates 'svg'
. In previous releases, the
default value of the SnapshotFormat
property was
'auto'
, which indicated 'svg'
for HTML and PDF
reports and 'emf'
or 'png'
for Word reports, depending
on the platform.
Word reports that contain SVG images require Word 2016 or a later version. In MATLAB® R2019b or a later release, to generate a report with images that are
compatible with earlier versions of Word, set the SnapshotFormat
property to a value other than 'svg'
. To specify the image format used by
default in earlier releases of MATLAB, set SnapshotFormat
to:
'emf'
for a Windows platform'png'
for a UNIX® or Mac platform
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)