Why are system users unable to create and modify their own pathdef.m files in MATLAB 7.7 (R2008b)?

10 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
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 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

尚未输入任何标签。

产品


版本

R2008b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by