| MATLAB® | ![]() |
| On this page… |
|---|
Create Projects in Source Control System Specify Source Control System with MATLAB® Software |
In your source control system, create the projects that your directories and files will be associated with.
All files in a directory must belong to the same source control project. Be sure the working directory for the project in the source control system specifies the correct path to the directory on disk.
This example uses the project my_thesis_files in Microsoft® Visual SourceSafe®. This illustration of the Current Directory browser shows the path to the directory on disk, I:\my_thesis_files.

The following illustration shows the example project in the source control system.

To set the working directory in Microsoft Visual SourceSafe for this example, select my_thesis_files, right-click, select Set Working Folder from the context menu, and specify D:\my_thesis_files in the resulting dialog box.

In MATLAB, specify the source control system you want to access. Select File > Preferences > General > Source Control.
The currently selected system is shown in the Preferences dialog box. The list includes all installed source control systems that support the Microsoft® Common Source Control standard.
Select the source control system you want to interface with and click OK.

MATLAB remembers preferences between sessions, so you only need to perform this action again when you want to access a different source control system.
A function alternative to select a source control system is not available, but you can list all available source control systems using verctrl with the all_systems argument. Use cmopts to display the name of the currently selected source control system.
Register a source control system project with a directory in MATLAB, that is, associate a source control system project with a directory and all files in that directory. Do this only one time for any file in the directory, which registers all files in that directory:
In the MATLAB Current Directory browser, select a file that is in the directory you want to associate with a project in your source control system. For example, select D:\my_thesis_files\wind.m. This will associate all files in the my_thesis_files directory.
Right-click, and from the context menu, select Source Control > Register Name_of_Source_Control_System Project with MATLAB. The Name_of_Source_Control_System is the source control system you selected using preferences as described in Specify Source Control System with MATLAB® Software.
The following example shows Microsoft Visual SourceSafe.

In the resulting Name_of_Source_Control_System Login dialog box, provide the username and password you use to access your source control system, and click OK.

In the resulting Choose project from Name_of_Source_Control_System dialog box, select the source control system project to associate with the directory and click OK. This example shows my_thesis_files.

The selected file, its directory, and all files in the directory, are associated with the source control system project you selected. For the example, MATLAB associates all files in D:\my_thesis_files with the source control project my_thesis_files.
Add files to the source control system. Do this only once for each file:
In the Current Directory browser, select files you want to add to the source control system.
Right-click, and from the context menu, select Source Control > Add to Source Control.
The resulting Add to source control dialog box lists files you selected to add. You can add text in the Comments field. If you expect to use the files soon, select the Keep checked out check box (which is selected by default). Click OK.

If you try to add an unsaved file, the file is automatically saved upon adding.
The function alternative is verctrl with the add argument.
![]() | Source Control Interface on Microsoft® Windows® | Checking Files Into and Out of Source Control from the MATLAB® Desktop on Microsoft® Windows® | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |