Why are system users unable to create and modify their own pathdef.m files in MATLAB 7.7 (R2008b)?
10 views (last 30 days)
Show older comments
I am a system administrator. My users are not able to modify and save paths in MATLAB.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
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 Comments
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!