Main Content

Select Models to Compare

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

For information about opening the Comparison Tool from the Files and Project panels, see Open the Comparison Tool.

Tip

If you are using source control outside of MATLAB®, you can customize external source control tools to use MATLAB comparison and merge tools.

For instructions, see Customize External Source Control to Use MATLAB for Diff and Merge.

Compare Two Models on Disk

You assign a new hire a task to improve the readability of the mysimple_stats_block1.slx model. You share the model in an email attachment.

After finishing the task, the new hire shares the improved model mysimple_stats_block2.slx.

To compare the models on disk, use one of these methods.

  • In the Files panel, select the two model files. Right-click and select Compare Selected Files/Folders.

  • Open one of the models in the Simulink Editor. On the Modeling tab, in the Evaluate & Manage section, click Compare To. Then, browse and open the model you want to compare to.

  • In the Command Window, enter this command.

visdiff("mysimple_stats_block1.slx","mysimple_stats_block2.slx");

Compare Model to Revision

You assign a new hire a task to improve the readability of the mysimple_stats_block.slx model. The model is under Git™ source control.

After finishing the task, the new hire commits the changes to the repository.

To compare the two different model revisions, in the Files panel, select the model file. Right-click and select Source Control > Show Revisions.

In the Log for file dialog box, select the two revisions from the commit history and click Compare Selected.

See Also

|

Topics