Main Content


Update trace information for pending artifact changes in the project

Since R2021b



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


    When you collect metrics programmatically, call updateArtifacts before running tests to ensure that the dashboard tracks the test results.

    If the dashboard user interface is not used for a project, the dashboard does not track test results produced in Simulink Test Manager that have not been exported to a results file or been saved to a report.

    Note that there is also a function updateArtifacts (Fixed-Point Designer) in the Fixed-Point Designer™ documentation.


    collapse all

    Collect metric results on the requirements-based testing artifacts in a project.

    Open a project that contains models and testing artifacts. For this example, in the MATLAB® Command Window, enter:


    Create a metric.Engine object. You can use the metric.Engine object to collect metric results for the current project.

    metric_engine = metric.Engine();

    Update the trace information for metric_engine to ensure that the artifact information is up to date.


    Collect results for the metric 'RequirementsPerTestCase' by using the execute function on the metric.Engine object.


    Use the function getMetrics to access the results. Assign the array of result objects to the results variable.

    results = getMetrics(metric_engine,'RequirementsPerTestCase');

    Access the metric results data by using the properties of the metric.Result objects in the array.

    for n = 1:length(results)
        disp(['Test Case: ',results(n).Artifacts(1).Name])
        disp(['  Number of Requirements: ',num2str(results(n).Value)])

    Input Arguments

    collapse all

    Metric engine object for which you want to collect metric results, specified as a metric.Engine object.

    Version History

    Introduced in R2021b