Check Out Files on UNIX Platforms

If you are a new user to source control, it is recommended that you select a source control system that is part of the MathWorks® source control integration with the Current Folder browser, such as Subversion® or Git™. For more information, see SVN and Git Source Control Integration topics.

Checking Out One or More Files Using the Current Folder Browser

  1. In the Current Folder browser, select the file or files to check out.

  2. Right-click, and from the context menu, select Source Control > Check Out. The Check out file(s) dialog box opens.

  3. Complete the dialog box:

    1. To check out the versions that were most recently checked in, select the Latest version option.

    2. To check out a specific version of the files, select the Version number option and type the version number in the field.

    3. To prevent others from checking out the files while you have them checked out, select Lock latest version. To check out read-only versions of the file, clear Lock latest version.

  4. Click OK.

An error appears in the Command Window if a file is already checked out.

After checking out files, make changes to them using MATLAB® software or another software product, and save the files. For example, edit a file in the Editor.

If you try to change a file without first having checked it out, the file is read-only, as seen in the title bar, and you will not be able to save any changes. This protects you from accidentally overwriting the source control version of the file.

If you end the MATLAB session, the file or files remain checked out. You can check in files from within MATLAB during a later session, or directly from your source control system.

Checking Out a Single File Using the Editor, or the Simulink or Stateflow Products

  1. Open the MATLAB program file, Simulink® model, or Stateflow® chart you want to check out. The title bar indicates the file is read-only.

  2. Select File > Source Control > Check Out. The Check out file(s) dialog box opens.

  3. Complete the dialog box as described in step 3 of Checking Out One or More Files Using the Current Folder Browser, and click OK.

Function Alternative

Use checkout to check out a file from the source control system. You can check out multiple files at once and specify checkout options. The checkout function takes this form:

checkout({'file1','file2', ...},'option','value')

For filen, use the complete path and include the file extension.

Use the option argument to

  • Check out a read-only version of the file — set the lock option value to off.

  • Check out the file even if you already have it checked out — set the force option value to on.

  • Check out a specific version of the file — use the revision option, and assign the version number to the value argument.

The options apply to all files being checked out. The files can be open or closed when you use checkout.

Example Using checkout Function—Check Out a Specific Version of a File

To check out the 1.1 version of the file clock.m, type


For other examples, see the reference page for checkout.

Was this topic helpful?