Development Environment    

Comparing the Working Copy of a File to the Latest Version in Source Control

You can use the Differences option to compare the current working copy of a file on disk with the latest checked-in version of the file in the source control system. Note that you can only show differences on one file at a time, not multiple files.

Comparing M-Files

To show differences of an M-file:

  1. Select Source Control -> Differences from the File menu in the MATLAB Editor.
  1. A dialog box from the currently selected source control system opens. For example, if Microsoft Visual SourceSafe is the currently selected source control system, then the Difference Options dialog box opens.

  1. Click OK.
  1. The Microsoft Visual SourceSafe Differences dialog box opens. This compares the working copy of the file to the latest checked-in version of the file.

Comparing Simulink and Stateflow Model Files

To show differences of a Simulink or Stateflow model with Simulink Performance Tools installed on your system:

  1. Select Source Control -> Differences from the File menu in the Simulink or Stateflow model.
  1. The MATLAB Get latest version dialog box opens.

  1. Click OK.
  1. A dialog box from the currently selected source control system opens stating that there is a writable, working copy of the file. The dialog box will give you the option of either keeping the writable, working copy or replacing it with the latest version from the source control system. For example, if Microsoft Visual SourceSafe is the currently selected source control system, then the following dialog box opens.

  1. Select Replace your local file with this version from SourceSafe? or the equivalent option in other source control systems.
  1. The Simulink Graphical Merge tool opens. For example, the following dialog shows that the Stick Input and alpha (rad) parameters in the Controller subsystem of the F14 model have been changed.

Function Alternative for Showing File Differences

Use isdiff as the first argument in the verctrl function to return a Boolean value to the window, which indicates whether or not there are any differences between the current file on disk and the latest checked-in version of the file. The verctrl function with the isdiff argument has this form:

This will return the following in the command window if the two copies of the file are different:

Use showdiff as the first argument in the verctrl function to show the differences between the disk copy of a file and the latest checked-in version in the source control system. Note that the verctrl function with the showdiff argument does not return anything. The verctrl function with the showdiff argument has this form:


  Showing File History Displaying Source Control Properties of a File