To move or add project files, you can drag them to the project, or use clipboard operations.
To add files to your project, you can paste files or drag them from your operating system file browser or the MATLAB® Current Folder browser onto the Project files view in the project. When you drag a file to the Project files view, you add the file to the project. For projects under source control, you also add the file to source control.
To move files within your project, cut and paste or drag files in the project.
See also Add Files to the Project.
When you rename, delete, or remove files or folders in a project, the project checks for impact in other project files. You can find and fix impacts such as changed library links, model references, and model callbacks. You can avoid refactoring pain tracking down other affected files. Automatic renaming helps to prevent errors that result from changing names or paths manually and overlooking or mistyping one or more instances of the name.
For example:
When renaming a library, the project offers to automatically update all library links to the renamed library.
When renaming a class, the project offers to automatically update all classes
that inherit from it. If you rename a .m
or .mlx
file, the project offers to automatically update any files and callbacks that
call it.
When deleting files or removing them from the project, the project prompts you if other files refer to them. You must decide how to fix the affected files manually.
When renaming a C file, the project prompts you to update the S-function that uses it.
When renaming buses or bus elements using the Simulink Bus Editor, the project prompts you to update all usages in the project.
To use automatic updates:
Rename a model, library, or MATLAB file in a project.
The project runs a dependency analysis to look for impacts in other files.
In the Rename dialog box, you can examine impacted files, choose to rename and update, just rename, or cancel renaming the file.
If you choose automatic updates, you can examine the results in updated files.
Open the power window example project by entering in MATLAB:
slexPowerWindowStart
In a project, expand the model
folder, and rename the
slexPowerWindowControl.slx
model to
slexPowerWindowControlSystem.slx
.
The project runs a dependency analysis to look for impacts in other files, and then the Rename dialog box reports impacted files.
In the Rename dialog box, click Show impacted files. Expand the last impacted file to view the dependency, which is a model reference.
To view the dependency highlighted in the model, double-click the last
Model Reference line in the Rename dialog box. Observe the
model name on the highlighted control block,
slexPowerWindowControl
.
In the Rename dialog box, click Rename and Update.
The project updates the impact files to use the new model name in model references. When the project can automatically rename items, it reports success with a check mark. With some impacts, you must decide how to fix the affected files manually.
Examine the results by double-clicking items in the Rename dialog box.
Double-click the last Model Reference line. Check if the model
name on the highlighted control block is updated to
slexPowerWindowControlSystem
.