Main Content

generateReport

Generate report file that contains metric results

Description

example

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(___,Name,Value) specifies options using one or more name-value arguments. For example, 'Type','html-file' generates an HTML file.

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.

dashboardCCProjectStart

The project contains db_Controller, 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 the engine was executed without the argument for ArtifactScope, the engine collects metrics for the db_Controller 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

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.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'Type','html-file'

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

Data Types: logical

Full file name for generated report, specified as a character vector or string scalar. Use the location 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