slreportgen.report.ScheduleDiagram Class
Namespace: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Create schedule diagram reporter for a Simulink® schedule diagram. Schedule diagram reporters create a snapshot of the schedule diagram and add the snapshot to the report as an image with an optional caption, and an optional legend snapshot. Use the Source property to specify the desired scope and the IncludeLegendSnapshot property to specify whether to include the legend snapshot.
Note
To use a ScheduleDiagram
reporter in a report, you must create the
report using the slreportgen.report.Report
class.
The slreportgen.report.ScheduleDiagram
class is a handle
class.
Creation
Description
sets the Source
property to diagram
= ScheduleDiagram(source
) source
. Adding this reporter to a
slreportgen.report.Report
object, without any further modification,
generates a snapshot of the specified schedule diagram based on the default settings of
the slreportgen.report.Report
object. The snapshot displays in the
generated report as an image with a caption. See slreportgen.report.Report
.
sets properties using name-value pairs. You can specify multiple name-value pair
arguments in any order.diagram
= ScheduleDiagram(Name=Value
)
Properties
Source
— Schedule diagram
string scalar | character vector | handle | slreportgen.finder.DiagramResult
| ...
Schedule diagram, specified as one of these values:
String scalar or character vector that contains the name or handle of an open or loaded Simulink model
slreportgen.finder.BlockResult
object that represents a Simulink model reference block
Snapshot
— Snapshot reporter
mlreportgen.report.FormalImage
object
Snapshot reporter, specified as an mlreportgen.report.FormalImage
object. Use the properties of the
FormalImage
object to specify the caption for the snapshot image
or to further customize the size of the image.
Note
The reporter initializes the Snapshot
property. Do not reset
this property.
SnapshotFormat
— Snapshot image format
"png"
(default) | "jpg"
| "tif"
| "pdf"
Snapshot image format, specified as
"png"
(default), "jpg"
,
"pdf"
, or "tif"
. The table lists which image
formats are supported for which report types.
Image Format | File Extension | Supported in HTML | Supported in Word | Supported in PDF |
---|---|---|---|---|
JPEG image | .jpg | Yes | Yes | Yes |
.pdf | No | No | Yes | |
Portable Network Graphics | .png | Yes | Yes | Yes |
TIFF image | .tif | No | Yes | Yes |
Data Types: char
| string
Scaling
— Scaling options for snapshot image
"auto"
(default) | "custom"
| "none"
Scaling options for the snapshot image, specified as "auto"
,
"custom"
, or "none"
.
Scaling
controls the size of the snapshot image in the image
file. Supported scaling options are:
"auto"
— For PDF or Word (DOCX) output, use this option to scale the snapshot image to fit the current page layout while maintaining its aspect ratio. First, the reporter scales the snapshot image to the page width. If the image height exceeds the page height, the reporter scales the image down again. This additional scaling ensures that the image fits the current page with an extra one inch spacing. Scaling does not apply to HTML output."custom"
— Use this option to scale the snapshot image based on the values of theHeight
andWidth
properties."none"
— Do not perform scaling
For a PDF image, the size limit is 10000px for width and height. For all other image types, the size limit is the screen size.
Note
The "auto"
and "custom"
options use the MATLAB®
print
command to resize the figure. If the figure is too large to fit
in the specified space, the print
command crops the snapshot image. To
avoid cropping, set the Scaling property to "none" and use the reporter specified by the
Snapshot
property to size the image. Because the reporter reduces
the size of the text with the rest of the image, fine details may not be legible unless you
zoom the image. See Resize Figure Snapshot Image.
Note
A java.lang.OutOfMemoryError
can occur when the
Scaling
is set to "custom"
, and
Height
and Width
properties are set to large
values. To avoid or solve this error, use smaller Height
and
Width
property values.
Data Types: char
| string
Height
— Height of snapshot image
"6in"
(default) | character vector | string scalar
Height of the snapshot image, specified as a character vector or string scalar that
consists of a number followed by an abbreviation for a unit of measurement. For example,
"2in"
specifies two inches. The default snapshot is 6 inches.
Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF images, the height limit is 10000 pixels. For all other image types, the height limit is the screen height.
Example: "2in"
Data Types: char
| string
Width
— Width of snapshot image
"6.5in"
(default) | character vector | string scalar
Width of the snapshot image, specified as a character vector or string scalar that
consists of a number followed by an abbreviation for a unit of measurement. For example,
"2in"
specifies two inches. The default snapshot width is 6.5
inches. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF images, the width limit is 10000 pixels. For all other image types, the width limit is the screen width.
Example: "2in"
Data Types: char
| string
IncludeLegendSnapshot
— Whether to include a snapshot of the legend for the schedule editor graph
true
(default) | false
Whether to include a snapshot of the legend for the schedule editor graph, specified
as true
or false
. If true
, the
report includes a snapshot of the legend for the schedule editor graph.
Data Types: logical
LegendSnapshot
— Legend snapshot reporter
mlreportgen.report.FormalImage
object
Legend snapshot reporter, specified as an mlreportgen.report.FormalImage
object. Use the properties of the
FormalImage
object to specify the caption for the snapshot image or
to further customize the size of the image.
Note
The reporter initializes the LegendSnapshot
property. Do not
reset this property.
LegendScaling
— Scaling options for legend snapshot image
"auto"
(default) | "custom"
Scaling options for the legend snapshot image, specified as
"auto"
or "custom"
. Scaling
controls the size of the legend snapshot image in the image file. Supported scaling
options are:
"auto"
— For PDF or Word (DOCX) output, use this option to scale the snapshot image to fit the current page layout while maintaining its aspect ratio. First, the reporter scales the snapshot image to the page width. If the image height exceeds the page height, the reporter scales the image down again. This additional scaling ensures that the image fits the current page with an extra one inch spacing. Scaling does not apply to HTML output."custom"
— Use this option to scale the snapshot image based on the values of theLegendHeight
andLegendWidth
properties.
For a PDF image, the size limit is 10000px for width and height. For all other image types, the size limit is the screen size.
Note
The "auto"
and "custom"
options use the MATLAB
print
command to resize the figure. If the figure is too large to fit
in the specified space, the print
command crops the snapshot image. To
avoid cropping, set the Scaling property to "none" and use the reporter specified by the
Snapshot
property to size the image. Because the reporter reduces
the size of the text with the rest of the image, fine details may not be legible unless you
zoom the image. See Resize Figure Snapshot Image.
Note
A java.lang.OutOfMemoryError
can occur when the
Scaling
is set to "custom"
, and
Height
and Width
properties are set to large
values. To avoid or solve this error, use smaller Height
and
Width
property values.
Data Types: char
| string
LegendHeight
— Height of legend snapshot image
"3.2in"
(default) | character vector | string scalar
Height of legend snapshot image, specified as a character vector or string scalar
that consists of a number followed by an abbreviation for a unit of measurement. For
example, "2in"
specifies two inches. The default legend snapshot is
3.2 inches. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF images, the height limit is 10000 pixels. For all other image types, the height limit is the screen height.
Example: "2in"
Data Types: char
| string
LegendWidth
— Width of legend snapshot image
"4.5in"
(default) | character vector | string scalar
Width of legend snapshot image, specified as a character vector or string scalar
that consists of a number followed by an abbreviation for a unit of measurement. For
example, "2in"
specifies two inches. The default legend snapshot
width is 4.5 inches. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF images, the width limit is 10000 pixels. For all other image types, the width limit is the screen width.
Example: "2in"
Data Types: char
| string
TemplateSrc
— Source of template for this reporter
character vector | string scalar | reporter or report | DOM document or document part
Source of the template for this reporter, specified in one of these ways:
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
Document Object Model (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 you
append this reporter. 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 the 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 specified by
the TemplateSrc
property of this reporter.
Data Types: char
| string
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 an mlreportgen.dom.LinkTarget
object. A character vector or string scalar
value converts to a LinkTarget
object. The link target immediately
precedes the content of this reporter in the output report.
Methods
Public Methods
getSnapshotImage | Image snapshot of schedule diagram |
getLegendSnapshotImage | Image snapshot of schedule diagram legend |
slreportgen.report.ScheduleDiagram.createTemplate | Create schedule diagram template |
slreportgen.report.ScheduleDiagram.customizeReporter | Create custom schedule diagram reporter class |
slreportgen.report.ScheduleDiagram.getClassFolder | Schedule diagram class definition 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 Schedule Diagram and Legend to Report
Document a Simulink model that uses several referenced models and includes a detailed schedule of tasks edited with the Schedule editor. Include a single legend for all of the Schedule Editor snapshots.
Import the namespaces so that you do not have to include the fully qualified name when you call the object constructors and methods.
import slreportgen.report.* import mlreportgen.report.* import slreportgen.finder.*
Open the Simulink model.
model = "ex_engine_speed_control_system";
open_system(model);
sim(model);
Create an HTML report and the first chapter.
rpt = slreportgen.report.Report("Schedule Diagram", "html-file"); open(rpt); ch = mlreportgen.report.Chapter("Scheduling");
Add a legend for the Schedule Editor snapshots at the start of the chapter.
schedDiag = ScheduleDiagram(model);
legendImg = getLegendSnapshotImage(schedDiag, rpt);
fm = FormalImage(legendImg);
fm.Caption = "Task Diagram Legend";
append(ch, fm);
Report on the model and all referenced models. Create a new section for each diagram and add the section to the chapter.
diagFinder = SystemDiagramFinder(model); diagFinder.Properties = {'Type', 'block_diagram'}; while hasNext(diagFinder) result = next(diagFinder); % Create a section for this result s = Section(result.Name); % Add a schedule diagram schedDiag = ScheduleDiagram(result); % Legend is included at the beginning of the chapter already schedDiag.IncludeLegendSnapshot = false; append(s, schedDiag); append(s, ExecutionOrder(result)); append(ch, s); end append(rpt, ch);
Close and view the report.
close(rpt); rptview(rpt);
Version History
Introduced in R2024b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)