I have removed about 75 unnecessary folders. How do I easily remove them from my path?
12 ビュー (過去 30 日間)
古いコメントを表示
I cleaned up my disk, but my "path" still looks for all the deleted folders. Is there an easy way to remove them from my path? I'd love to tell Matlab to simply remove all the folders it failed to find. I don't want to have to do them one at a time!
0 件のコメント
回答 (3 件)
Jan
2013 年 1 月 11 日
The method suggested by Imnage Analyst in detail:
P = regexp(path, pathsep, 'split');
for iP = 1:numel(P)
if exist(P{iP}, 'dir') ~= 7
rmpath(P{iP});
end
savepath;
0 件のコメント
Image Analyst
2013 年 1 月 11 日
You can start from scratch with the restoredefaultpath command. Or you can get the path into a string, then split the string up with regexp() and go though each one testing it with exist(folder, 'dir') and if the folder doesn't exist, call rmpath().
1 件のコメント
Image Analyst
2013 年 1 月 11 日
Be sure to call savepath() after you clean it up so you don't have to do it each time you start MATLAB.
Richard Crozier
2013 年 1 月 11 日
A better long term solution is to use a script to generate your path every time you start matlab instead of hard coding the path. Matlab looks for the script startup.m on startup, you can put commands such as
addpath( genpath('my/top/level/dir') )
in here to add a directory and subdirectories each time.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Search Path についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!