Main Content

Review Changes in Simulink Models

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:

  • When you require a peer review of your changes

  • Before you share or submit a version of your code to source control

  • When you want to pinpoint when an issue was introduced

  • When you want to examine your own local changes in detail

Using the Comparison Tool, you can:

  • Compare and review changes in SLX and MDL model files from any version of Simulink®. If needed, the Comparison Tool resaves the models in the current release using the SLX format before opening the comparison report.

  • Visualize and highlight changes in the Simulink Editor.

  • Export the comparison results to send for peer review.

  • Use merge mode to port or restore changes in different models.

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:

Comparison Tool Usage Tips and Limitations

Compare Models with Identical Names

When you compare model files that have identical names, the Comparison Tool creates a read-only copy of one model named modelname_TEMPORARY_COPY before performing a comparison. The temporary copy is read-only to prevent making changes that can be lost.

If one of the models with identical names is open when you perform a comparison, the Comparison Tool asks you to save and close the model to avoid shadowing issues. For more information about shadowed files, see Shadowed Files.

To automatically close models of the same name when you compare them, disable the prompt by using these commands.

opt = slxmlcomp.options;

MATLAB® stores this preference across sessions. To be prompted about closing identically-named models, set the setCloseSameNameModel property to false.

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

See Also