Files and Folders That MATLAB Accesses
Where Does MATLAB Look for Files?
When you do not specify a path to a file, MATLAB® looks
for the file in the current folder or on the search path. Functions
in the current folder take precedence over functions with the same
file name that reside anywhere on the search path. To identify the
current folder, type
pwd in the Command Window.
To make files accessible to MATLAB, do one of the following:
Change the current folder to the folder that contains the files. Use the
cdfunction or browse to a different folder in the Current Folder toolbar:
Add the folder that contains the files to the search path. Changes you make to the search path apply to the current MATLAB session. To reuse the modified search path in future MATLAB sessions, save your changes.
Store individual files in the
folder, which is on the search path. To determine the location of this folder, run the
Files and Folders You Should Add to the Search Path
The MATLAB search path should include:
Folders containing files that you run.
Folders containing files that are called by files you run.
Subfolders containing files that you run. Making a folder accessible does not make its subfolders accessible.
For files in
@ (class) and
folders, make the parent folder accessible. For details, see Folders Containing Class Definitions.
If files call other files that are in multiple folders, determine the location of all the called files by performing a dependency analysis on your files. For more information, see Dependencies Within a Folder
When Multiple Files Have the Same Name
Name conflicts arise when MATLAB has access to multiple files with the same name, and when a file has the same name as a variable in the base workspace or a built-in function for a MathWorks® product.
When there are name conflicts, MATLAB follows these precedence rules:
The file that MATLAB does not use is called a shadowed file. In some cases, MATLAB warns you that a shadowed file exists.
Locations of MathWorks Products
Files and folders for products provided by MathWorks are
The files and folders under
important to your installation. In particular:
Do not store your personal files and folders in
Do not change files, folders, and subfolders in
/toolbox. The exception is the
pathdef.mfile, which you can update and save in its default location,
To see a list of all toolbox folder names supplied with MathWorks products, run: