Main Content

slreportgen.report.StateTransitionTable class

Package: slreportgen.report
Superclasses: slreportgen.report.Reporter

State Transition Table Reporter

Description

Use objects of the slreportgen.report.StateTransitionTable class to report on Stateflow.StateTransitionTableChart objects and Simulink® State Transition Table blocks. The reporter includes:

  • A table with details about the state transition table.

  • An optional property table for symbols used by the state transition table.

StateTransitionTable objects can only be used with slreportgen.report.Report objects.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

sttReporter = StateTransitionTable() creates an empty state transition table reporter. Set the Object property before you add sttReporter to a report.

example

sttReporter = StateTransitionTable(sttObj) creates an slreportgen.report.StateTransitionTable object and sets the Object property to sttObj.

sttReporter = StateTransitionTable(Name=Value) sets Properties using one or more name-value arguments.

Properties

expand all

State transition table on which to report, specified as one of these options:

valuedescription
string scalar or character arrayPath of the State Transition Table block on which to report
Block handleA block handle to the State Transition Table block on which to report. To get a block handle, use the function getSimulinkBlockHandle or get_param.
Stateflow.StateTransitionTableChartThe object on which to report
slreportgen.finder.BlockResultSearch result object that represents the block with a Stateflow.StateTransitionTableChart object on which to report
slreportgen.finder.DiagramElementResultSearch result object that represents the Stateflow.StateTransitionTableChart object on which to report.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string | double | Stateflow.StateTransitionTableChart | slreportgen.finder.BlockResult | slreportgen.finder.DiagramElementResult

Whether to include a property table for the symbols used by the state transition table, specified as numeric or logical 0 (false) or 1 (true). The property table includes symbols for input and output ports and for local, constant, parameter, and Data Store Memory data elements. You can choose whether to compile the model before adding the symbol values to the report by setting the CompileModelBeforeReporting property of the slreportgen.report.Report object.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Formatter of the symbols table, if included, specified as an mlreportgen.report.BaseTable object. The default value of this property is a BaseTable object with the TableStyleName property set to the STTTableReporter style, which is defined in the default templates for StateTransitionTable. To customize the symbols table, customize the existing BaseTable object or assign and customize a new BaseTable object to the TableReporter property.

Attributes:

GetAccess
public
SetAccess
public

Data Types: mlreportgen.report.BaseTable

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 in TemplateSrc used to render the generated content, specified as a character vector or a string scalar. If TemplateName is empty, then the reporter uses the default TemplateSrc template.

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

This example shows how to report on a State Transition Table block.

Import these packages so that you do not have to use long, fully qualified class names.

import slreportgen.utils.*
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.dom.*
import mlreportgen.report.*

Create an slreportgen.report.Report of type DOCX with a chapter.

theReport = Report("STT_Generated_Report","docx");
chapter = Chapter("A State Transition Table Block");
append(theReport,chapter);

Load the Simulink® model and create an slreportgen.finder.BlockFinder object to find the blocks in the model.

modelName = "slrgex_stt_boiler";
load_system(modelName);
blockFinder = BlockFinder(modelName);

Iterate through the block search results to find a result that represents a State Transition Table block.

while(blockFinder.hasNext)
  nextRes = blockFinder.next;

When you find a result that represents a State Transition Table block, use this result to create an slreportgen.report.StateTransitionTable reporter. Then set the foundSST flag to true and break the loop.

  if(isStateTransitionTableBlock(nextRes))
    sttReporter = StateTransitionTable(Object=nextRes,IncludeSymbols=true);

Append the StateTransitionTable reporter to the report. Close the report and the model, then view the report.

    append(theReport,sttReporter);
    close(theReport);
    close_system(modelName);
    rptview(theReport);

Return to end the execution of the example.

    return;
  end
end

The next block of code is executed only if no State Transition Table block is found in the model. Close the model and the report.

close_system(modelName);
close(theReport);

Version History

Introduced in R2022a