Review Changes in Simulink Models - MATLAB & Simulink (original) (raw)

Main Content

Use the Comparison Tool to review and merge differences between two model files on disk or between different revisions of the same file.

In a collaborative environment, you typically compare models:

Using the Comparison Tool, you can:

The Comparison report shows only portions of the files that differ.

Follow these steps to understand changes in your model, export comparison results for peer review, and merge differences, if required:

  1. Select Models to Compare
  2. Understand Simulink Model Comparison Changes
  3. Export, Print, and Save Model Comparison Results
  4. Port or Restore Model Changes in Comparison Report

Comparison Tool Usage Tips and Limitations

Compare Models with Identical Names

When you compare model files that have the same names as already loaded models, the Comparison Tool checks if the file paths match the already loaded models before performing a comparison. If the file paths do not match the paths of the already loaded models, to avoid shadowing issues, the Comparison Tool loads the models using different names_`modelname`__X. For more information about shadowed files, see Shadowed Files.

To automatically close the loaded models that have the same name before performing a comparison, use these commands. The Comparison Tool only closes the models if they do not have unsaved changes.

opt = slxmlcomp.options; opt.setCloseSameNameModel(true);

MATLABĀ® stores this setting across sessions.

Compare Model Hierarchies

The Comparison Tool performs a comparison on the currently selected models only. The comparison report does not include changes to referenced models or linked libraries.

If you are comparing models that contain referenced models with the same name, check that your referenced models are not on the MATLAB path before you generate the report. Keeping referenced models with the same name on the path might result in shadowing issues and display different comparison results.

More About Model Shadowing Impact

Simulink records information in the top-level model about the interface between the top-level model and children models. This interface information in the top-level model enables incremental loading and diagnostic checks without any need to load children models.

See Also

visdiff | Comparison Tool