1. 加入文件夹搜索路径 — addpath
ddpath('folderName1','folderName2','folderName3' ...)
addpath('folderName1','folderName2','folderName3' ... flag)
addpath folderName1 folderName2 folderName3 ... -flag)
previous_path = addpath(...)
这里的flag为
‘-begin’ :Add specified folders to the top of the search path.
‘-end’ :Add specified folders to the bottom of the search path.
‘-frozen’ :Disables change detection for folders you add to the path, which conserves Windows change notification resources (Windows only). Typehelp changenotification in the Command Window for more information.
例子:
Add c:/matlab/myfiles to the top of the search path:
addpath('c:/matlab/myfiles')
Add c:/matlab/myfiles to the end of the search path:
addpath c:/matlab/myfiles -end
2. 加入文件夹及其下子文件夹 —addpath(genpath(‘c:/matlab/myfiles’))
如:Add myfiles and its subfolders to the search path:
On Windows, Add myfiles to the top of the search path, disable folder change notification, and display the search path before adding myfiles:
previous = addpath('c:/matlab/myfiles', '-frozen')
3. 去除文件夹搜索路径 rmpath
rmpath(‘folderName’) removes the specified folder from the search path . Use the full path forfolderName.
rmpath folderNameis the command form of the syntax.
4. 永久添加到搜索路径
pathtool/菜单: File -> Set Path
修改Matlab 相关配置文件pathdef.m % 位于 $MATLAB\toolbox\local\
先使用 path 或addpath命令将指定的目录加入到当前搜索路径中,然后使用 saveptah命令将当前搜索路径写入pathdef.m
Like this:
Like Loading...
Related