Main Content

slreportgen.report.Signal class

Package: slreportgen.report

Signal reporter

Since R2021a

Description

Use an object of the slreportgen.report.Signal class to report the properties of a signal.

Signals are the outputs of dynamic systems that are represented by blocks in a Simulink diagram and by the diagram itself. See Signal Basics.

Note

To use a Signal object in a report, you must create the report using the slreportgen.report.Report class or subclass.

The slreportgen.report.Signal class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

reporter = slreportgen.report.Signal() creates an slreportgen.report.Signal object with default property values. You must specify the signal to report by setting the Object property. Use other properties to customize the information reported and the formatting of the information.

example

reporter = slreportgen.report.Signal(object) sets the Object property to object.

reporter = slreportgen.report.Signal(Name=Value) sets the Signal object properties using name-value pairs. You can specify multiple name-value pair arguments in any order.

Properties

expand all

Block output port that represents the signal to report, specified as a handle. The signal reporter reports information about the properties of the output port and the properties of the line connected to the port.

Whether to report information about the Simulink.Signal object for this signal, specified as true or false. If this property is true, the signal reporter includes information about the Simulink.Signal object that specifies the attributes of the signal. The properties of the Simulink.Signal object are reported using an mlreportgen.report.MATLABVariable reporter. Use the MATLABVariableReporter property of this signal reporter to customize the appearance of the signal object information. If the signal is not associated with a signal object, nothing is reported.

Reporter for the Simulink.Signal object that defines the signal being reported, specified as an mlreportgen.report.MATLABVariable object. The default value is an empty MATLABVariable reporter with the DepthLimit property set to 0. The default reporter reports information about the Simulink.Signal object in a single table. To customize the appearance of the reported information, modify the properties of the default MATLABVariable reporter or replace the reporter with a customized MATLABVariable reporter. For example, the following code uses the PropertyFilterFcn property of the MATLABVariable reporter to display only specific properties of the Simulink.Signal object:

filterFcnHandle = @(variableName, variableObject, propertyName) ...
~ismember(propertyName, ["Description", "DataType", "Unit"]);
signalRptr.MATLABVariableReporter.PropertyFilterFcn = filterFcnHandle;
Some properties of signal objects, such as the CoderInfo property, have values that are also objects with properties. To display the properties of properties in separate tables, set the DepthLimit property of the MATLABVariableReporter to an integer that is greater than 0. For example:

signalRptr.MATLABVariableReporter.DepthLimit = 10;

Signal properties table formatter, specified as an mlreportgen.report.BaseTable object. The default value of this property is a BaseTable object with the TableStyleName property set to the SignalTable style, which is defined in the default template for a Signal reporter. To customize the appearance of the table, modify the properties of the default BaseTable object or replace the object with your own BaseTable object. If you add content to the Title property of the BaseTable object, the content appears in front of the table title in the generated report.

Whether to show signal properties that have empty values, specified as true or false.

Signal properties to report, specified as a string array or a cell array of character vectors. Specify any combination of these properties:

  • Name

  • Description

  • Source

  • Destination

  • NonvirtualDestination

  • DataType

  • Complexity

  • Dimensions

  • Min

  • Max

  • SampleTime

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.

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 specified by the TemplateSrc property for this reporter.

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

expand all

Examples

collapse all

Use an slreportgen.report.Signal object to include information about a signal in a report.

Import the MATLAB and Simulink Report API packages so that you do not have to use long, fully qualified class names.

import mlreportgen.report.*
import slreportgen.report.*

Load a model.

model_name = "slrgex_vdp";
load_system(model_name);

Create a Simulink report.

rpt = slreportgen.report.Report("signal_example","pdf");

Add a diagram of the model to the report.

append(rpt,slreportgen.report.Diagram(model_name));

Get the port handle for the signal that you want to report.

ph = get_param("slrgex_vdp/x1","PortHandles");
port = ph.Outport;

Create a chapter for the signal information.

ch = Chapter("x1");

Create a Signal reporter for the signal and append the reporter to the chapter.

signalRptr = slreportgen.report.Signal(port);
append(ch,signalRptr);

Add the chapter to the report. Close and view the report.

append(rpt,ch);
close(rpt);
rptview(rpt);

Version History

Introduced in R2021a