MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Automate Startup and Shutdown Tasks


When you open a project, MATLAB adds the project path to the MATLAB search path and
then runs or loads specified startup files. The project path and startup files help you set
up the environment for your project. Similarly, when you close a project, MATLAB
removes the project path from the MATLAB search path and runs specified shutdown
files. Shutdown files help you clean up the environment for your project. Use shutdown
files to undo the setup that occurs in startup files.

More specifically, when you open a project, MATLAB changes the current folder to the
project startup folder, and runs (.m and .p files) or loads (.mat files) any specified
startup file. For more information about configuring the startup folder, see “Set Startup
Folder” on page 31-9.

Specify Project Path


You can add or remove folders from the project path. Adding a project folder to the
project path ensures that all users of the project can access the files within it.

To add a folder to the project path, on the Project tab, in the Environment section, click
Project Path. Click Add Folder and select the folder that you want to add. To add a
folder and all of its subfolders, click Add with Subfolders.

To remove a folder from the project path, select the folder from the displayed list and
click Remove.

You also can add or remove a folder from the project Files view. Right-click the folder,
select Project Path, and select from the available options.

Folders on the project path appear with the project path icon in the Status column of
the Files view.

Set Startup Folder


When you open the project, the current working folder changes to the project startup
folder. By default, the startup folder is set to the project root.

To edit the project startup folder, on the Project tab, in the Environment section, click

Details. Then, in the Start up section, enter a path for the project startup folder.

Automate Startup and Shutdown Tasks
Free download pdf