Manage Project Files
This table shows how to add, move, rename, and open project files and folders. Some of these actions can also lead to automatic updates that affect other files. All can be undone and redone.
Action | Procedure |
---|---|
View project files. | In the Files view, click Project to display only the files and folders that are included in the project. |
View all files in a project folder. | To display all files and folders in the project folder, in the Files view, click All. You might not want to include all files in your project. For example, you might want to exclude SVN or CVS source control folders. For more information, see Work with Derived Files in Projects. |
Create a new project folder. | In the Files view, right-click in white space, and then click New > Folder. |
Add files to a project. | On the Project tab, click the down arrow to expand the Tools gallery. Under Project Files, click Add Files. Select from the list of unmanaged files in the project folder. You also can paste or drag files and folders from your operating system file browser or the Current Folder browser to the project Files view. When you drag a file to the Files view, MATLAB® adds the file to the project. To add a
file programmatically, use the |
Remove project files or folders. | In the Files view, right-click the file, and then select Remove from Project. To remove a file
programmatically, use the |
Move project files or folders. | Cut and paste or drag the files in the project. |
Rename project files or folders. | In the Files view, right-click the file, and then click Rename. |
Open project files. | In the Files view, right-click the file, and then click Open. You also can double-click the file. |
Preview project file contents without opening the file. | In the Files view, select the file. The panel in the bottom right of the Files view displays the file information and labels. To restore the panel if it is minimized, click the Restore button. |
Delete a project file or folder. | In the Files view, right-click the file, and then click Delete. |
Undo or redo an action | Click or at the upper right corner of the toolstrip. If you are using source control, you also can revert to a particular version of a file or project. For more information, see Revert Changes. |
Automatic Updates When Renaming, Deleting, or Removing Files
When you rename, delete, or remove files or folders in a project, the project runs a dependency analysis to check for effects on other project files. When the analysis is complete, the project displays the affected files. If you have not yet run a dependency analysis on the project, the analysis may take some time to run. Subsequent analyses are incremental updates, and so they run faster.
When renaming files, the project offers to automatically update references to the file. Automatically updating references to a file when renaming prevents errors that result from changing names or paths manually and overlooking or mistyping the name.
For example:
When renaming a class, the project offers to automatically update all classes that inherit from it.
When renaming a
.m
or.mlx
file, the project offers to automatically update files and callbacks that call it. The project does not automatically update.mlx
files. You need to update them manually.When renaming a C file, the project prompts you to update the S-function that uses it.
You can disable the automatic updates when renaming, deleting, or removing files in a project. On the MATLAB Home tab, in the Environment section, click Preferences. Select MATLAB > Project and clear the Detect project-wide references when renaming, removing, and deleting files option.
For more information about automatic updates when renaming, deleting, or removing Simulink® files such as library links, model references, and model callbacks, see Automatic Updates When Renaming, Deleting, or Removing Files (Simulink).