Main Content

slreportgen.report.ScheduleDiagram Class

Namespace: slreportgen.report
Superclasses: slreportgen.report.Reporter

Create schedule diagram reporter

Since R2024b

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

diagram = ScheduleDiagram creates an empty schedule diagram reporter based on the default report template. Use the Source property to specify a schedule diagram on which to report. Adding an ScheduleDiagram object with an empty Source property to a report produces an error.

diagram = ScheduleDiagram(source) sets the Source property to 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.

example

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

Properties

expand all

Schedule diagram, specified as one of these values:

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.

Snapshot image format, specified as "png" (default), "jpg", "pdf", or "tif". The table lists which image formats are supported for which report types.

Image FormatFile ExtensionSupported in HTMLSupported in WordSupported in PDF
JPEG image.jpgYesYesYes
PDF.pdfNoNoYes
Portable Network Graphics .pngYesYesYes
TIFF image.tifNoYesYes

Data Types: char | string

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 the Height and Width 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 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 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

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

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.

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 the LegendHeight and LegendWidth 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

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

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

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.

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

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

expand all

Examples

collapse all

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