Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 for MATLAB and Simulink Documentation | 2025.2

# File management

This chapter assumes that the P4 for MATLAB and Simulink is installed, you have created your project, and that it is connected to the P4 Server. If this is not the case please see the following chapters for instructions:

- Install the P4 for MATLAB and Simulink
- Connect to the P4 Server

This chapter covers file management in Simulink and MATLAB including:

- View the status of your project files
  - Simulink
  - MATLAB
- P4 Server Right-click menu options
  - Simulink P4 Server menu
  - MATLAB P4 Server menu
- Automatic checkout of project files
- Commit project files

## View the status of your project files

### Simulink

Navigate to the Simulink All Files View to view the status of your project files and folders.

#### Status column

- Green tick indicates that the file or the content of a folder is under P4 Server control.
- Period (.) indicates the file or the content of the folder is not under P4 Server control.

#### P4 column

File decorations in the P4 column indicate the state of each of the files in the P4 Server:

- Green circle file is not marked change
- Plus sign (+) file marked for add
- Blue square file has been marked for edit
- Empty circle file not under source control
- Period (.) file source control status is unknown

#### Revision column

Revision number: indicates the revision of the file in you workspace.

A revision number of -1 indicates that the file is marked for add but is not yet under P4 Server control.

### MATLAB

#### P4 column

File decorations in the P4 column indicate the state of each of the files in the P4 Server:

- Green circle file is not marked change
- Plus sign (+) file marked for add
- Blue square file has been marked for edit
- Empty circle file not under source control
- Period (.) file source control status is unknown

## P4 Server Right-click menu options

### Simulink P4 Server menu

To open the P4 Server menu, select one of more files/folders in your project and Right-Click to display the menu.

The menu contains the following items:

Menu option | Description
--- | ---
Extract Conflict Markers to File | Extracts the conflict markers from the selected files and enables you to compare the files causing the conflict. For instructions on extracting conflict markers, see the Extract Conflict Markers section of the MATLAB documentation.
Add to Project | Adds the selected file(s) to the Simulink project and opens the file for add locally. The file(s) are displayed under Modified Files and you must commit the file(s) to complete the process.
Remove from Project | Removes the file(s) from the project, commits the remove (delete) to the P4 Server, but does not delete the local file in your workspace.
Add Folder to Project (including Child Files) | Adds the file(s) in the selected folder(s) to the Simulink project and opens the file(s) for add locally. The file(s) are displayed under Modified Files and you must commit the file(s) to complete the process.
Refresh P4 Status | Checks the status of the workspace files in P4 Server.
Check for Modifications | Checks for modifications that are not registered in the pending changelist.
Get File Lock | Gets the latest version of the selected file(s) and then opens the file(s) for edit in the P4 Server. The file(s) are displayed in the Modified Files view. You must commit (submit) the file(s) to complete the process. Editing a file without clicking Get File Lock will do nothing unless the file is saved. Local files in your workspace are kept as read-only by the P4 Server. When you try to save the file you are prompted to click Overwrite. When you click Overwrite the file is opened for edit in the P4 Server.
Revert Local Changes and Release Locks | Discards any changes that you have made to the files in your workspace. This operation is known as reverting To discard changes you made to a file in your client workspace without submitting the changes to the depot. a file.
Show Revisions | Shows the revision history for the selected files.
Compare to Revision | Uses the p4 print command to stream the non-head revision to the user's machine. Local files are not updated.
Compare to Ancestor | Compares the selected file with the last checked-out version in the sandbox. For information about Compare to Ancestor, see the Compare Revisions section of the MATLAB documentation.
Revert using P4 | Reverts the selected file(s) to the revision in the P4 Server and overwrites those file(s) in your workspace.

### MATLAB P4 Server menu

To open the P4 Server menu, select one of more files/folders in your project Right-Click and select Source Control to display the menu.

The menu contains the following P4 Server items:

Menu option | Description
--- | ---
View and Commit Changes... | Commits the selected files to the P4 Server.
Get Revisions | Opens the Get Revision dialog and enables you to get a specific revision of the selected files.
Workspace: | Opens the P4 Connection dialog and enables you to edit how your Workspace is populated.
Pending: | Opens the Pending Changelist dialog and enables you to select your active changelist.
Refresh P4 Status | Checks the status of the workspace files in P4 Server.
Get File Lock | Gets the latest version of the selected files and then opens the files for edit in the P4 Server. The files are displayed in the Modified Files view. You must commit the files to complete the process. Editing a file without clicking Get File Lock will do nothing unless the file is saved. Local files in your workspace are kept as read-only by the P4 Server. When you save the file you are prompted to click Overwrite. When you click Overwrite the file is opened for edit in the P4 Server.
Revert Local Changes | Reverts the selected file(s) to the revision in the P4 Server and overwrites those file(s) in your workspace. Discards any changes that you have made to the files in your workspace. This operation is known as reverting To discard changes you made to a file in your client workspace without submitting the changes to the depot. a file.
Rename... | Renames the selected file or folder to the name that you specify.
Move... | Moves the selected file or folder to the location that you specify.

## Automatic checkout of project files

When you edit, add or delete a file in your project, the P4 for MATLAB and Simulink plugin automatically checks out the file, marks it for edit, add, or delete as appropriate, and adds it to the Pending changelist. You must commit the files to complete the process, see Commit project files.

- You cannot move a file to a different pending changelist.
- If you select a different pending changelist any files you add, edit, or delete will be added to the selected pending changelist.

## Commit project files

Commit the changes to you project files to the P4 Server:

1. To commit the project files to the P4 Server, either:
   - Simulink: click the Commit button in the Project tab.
   - MATLAB: click the Modified tab, open the current folder, Right-Click and select View and Commit Changes.....

2. Add a change description to the Comment text box and clcik Commit to commit the changes.

3. Your files are committed to the P4 Server.

Your search for returned results