Contenuto principale

generateReport

R2026b

Generate report file that contains metric results

Since R2022a

Description

reportFile = generateReport(metricEngine,App="DesignCostEstimation") creates a PDF report of the metric results from metricEngine in the root folder of the project. The generated report shows detailed design cost metric results. Before you generate the report, collect metric results for the engine by using the execute function. For a syntax to generate a report for requirements-based model metrics, see generateReport (Simulink Check).

example

reportFile = generateReport(metricEngine,Name=Value) specifies options using one or more name-value arguments.

example

Examples

collapse all

Use a metric.Engine object to collect design cost metric data on a model reference hierarchy in a project.

To open the project, enter this command.

openExample('simulink/VisualizeModelReferenceHierarchiesExample')

The project contains sldemo_mdlref_depgraph, which is the top-level model in a model reference hierarchy. This model reference hierarchy represents one design unit.

Create a metric.Engine object.

metric_engine = metric.Engine();

Update the trace information for metric_engine to reflect any pending artifact changes.

updateArtifacts(metric_engine)

Create an array of metric identifiers for the metrics you want to collect. For this example, create a list of all available design cost estimation metrics.

metric_Ids = getAvailableMetricIds(metric_engine,...
    App="DesignCostEstimation")
metric_Ids =

  1×2 string array

    "DataSegmentEstimate"    "OperatorCount"

To collect results, execute the metric engine.

execute(metric_engine,metric_Ids);

Because you executed the engine without specifying a ScopeId, the engine collects metrics for the entire sldemo_mdlref_depgraph model reference hierarchy.

Use the generateReport function to access detailed metric results in a PDF report. Name the report "MetricResultsReport.pdf".

reportLocation = fullfile(pwd,"MetricResultsReport.pdf");
generateReport(metric_engine,...
    App="DesignCostEstimation",...
    Type="pdf",...
    Location=reportLocation);

The report contains a detailed breakdown of the operator count and data segment estimate metric results.

Table of contents for generated report.

Input Arguments

collapse all

Metric engine object for which metric results are collected, specified as a metric.Engine object.

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: Type="html-file"

Digital thread URI for the unit or component model that you want to generate a report for, specified as a string scalar.

A digital thread URI is a stable identifier for an artifact, such as a model file. The digital thread uses these URIs as a consistent way to refer to artifacts across tools and in metric results. You can get the digital thread URI for a specific artifact or element by using the functions in the digitalthread.uri namespace, such as digitalthread.uri.fromFilePath.

Note

If you specify both ScopeId and ArtifactScope, ScopeId takes precedence.

Example: "mwdigitalthread://myProject/myModel.slx#addr=myModel/###"

Data Types: string

Whether to open the generated report automatically, specified as true or false.

Data Types: logical

Full file name for the generated report, specified as a character vector or string scalar. Use this argument to specify the name of the report. By default, the report is named untitled.

Example: "C:\MyProject\Reports\RBTResults.html"

File type for generated report, specified as "pdf" or "html-file".

Example: "html-file"

Output Arguments

collapse all

Full file name of generated report, returned as a character vector.

Version History

Introduced in R2022a

expand all