Why are system users unable to create and modify their own pathdef.m files in MATLAB 7.7 (R2008b)?
10 ビュー (過去 30 日間)
古いコメントを表示
I am a system administrator. My users are not able to modify and save paths in MATLAB.
採用された回答
MathWorks Support Team
2009 年 6 月 27 日
If users are not able to modify their paths, it is likely that they are reading the path from the administrator's write-protected 'pathdef.m' file.
You can create a 'pathdef.m' file for each user in the user's startup directory. The user startup directory is the working directory of MATLAB on a fresh startup, so the easiest way to resolve the issue is to have users type 'savepath pathdef.m' as the first command when they start MATLAB. They should then restart MATLAB, and the path will now be obtained from the newly created pathdef.m file. You can use the command 'which pathdef' to determine which 'pathdef.m' file is being used.
Another workaround is to add the following code to the MATLABRC file. The MATLABRC file is reserved for use by system administrators. You can find the location of this file by typing 'which matlabrc' at the MATLAB command prompt. If you add the following code, MATLAB will check whether a 'pathdef.m' file exists for the user on startup, and if it does not exist, one will be created specific to the user.
up = userpath;
up = regexprep(up,';',''); %Remove semicolon at end of userpath
if ~exist([up filesep 'pathdef.m'],'file')
savepath([up filesep 'pathdef.m'])
end
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!