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 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
. For more information about
shadowed files, see Shadowed Files.modelname
_X
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.