Main Content

updateArtifacts

Update trace information for pending artifact changes in project

Since R2022a

    Description

    example

    updateArtifacts(metricEngine) updates the trace information for any pending artifact changes in the metric data specified by metricEngine to ensure that artifacts are captured by the metrics. If an artifact has been created, deleted, or modified since the last time you used updateArtifacts, running updateArtifacts performs traceability analysis and updates the trace information.

    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 the engine was executed without the argument for ArtifactScope, the engine collects metrics for the 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 to collect metric results, specified as a metric.Engine object.

    Version History

    Introduced in R2022a