Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

Search Path

View and change MATLAB® search path

The MATLAB search path is a subset of all the folders in the file system. MATLAB uses the search path to efficiently locate files used with MathWorks® products. For more information, see What Is the MATLAB Search Path?

Functions

addpath Add folders to search path
rmpath Remove folders from search path
path View or change search path
savepath Save current search path
userpath View or change default user work folder
genpath Generate path name
pathsep Search path separator for current platform
pathtool Open Set Path dialog box to view and change search path
restoredefaultpath Restore search path to its factory-installed state
rehash Refresh function and file system path caches

Examples and How To

Change Folders on the Search Path

Interactively add and remove folders, and change the order of folders on the search path, for the current MATLAB session and for future MATLAB sessions.

Use Search Path with Different MATLAB Installations

The default search path changes for each MATLAB version because the default folders that come with the products change.

Add Folders to the MATLAB Search Path at Startup

The startup.m file is for specifying startup options. Add folders to the search path by including addpath statements in startup.m.

Assign userpath as Startup Folder (Macintosh or UNIX)

Assign the userpath folder as the startup folder on Macintosh or UNIX® platforms.

Toolbox Path Caching in MATLAB

For performance reasons, MATLAB caches toolbox folder information across sessions.

Concepts

What Is the MATLAB Search Path?

The search path, or path is a subset of all the folders in the file system. MATLAB software uses the search path to locate files used with MathWorks products efficiently.

Files and Folders that MATLAB Accesses

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.

Troubleshooting

Path Unsuccessfully Set at Startup

When there is a problem with the search path, you cannot use MATLAB successfully. There are several recovery steps available to correct problems with the search path.

Errors When Updating Folders on Search Path

You can encounter errors or unexpected behavior when you try to delete, rename, or move folders.

Was this topic helpful?