how to set Matlab path on windows 7 (with multiple user accounts)?

6 views (last 30 days)
Hello,
I am using R2013a on a 64-bit Windows 7 Professional box. There are three user accounts on the machine that use Matlab. When user1 runs "pathtool" from the prompt, adds some directories, and clicks "save path", the ownership of C:\Program Files\MATLAB\R2013a\toolbox\local\pathdef.m is changed from "Administrators" to user1. After this, user2 and user3 see a sequence of errors when trying to start matlab:
----- error message -------
C:\Program Files\MATLAB\R2013a\toolbox\local\pathdef.m: Cannot open file:
permission denied.
Warning: MATLAB did not appear to successfully set the search path. To
recover for this session of MATLAB, type "restoredefaultpath;matlabrc". To
find out how to avoid this warning the next time you start MATLAB, type
"docsearch problem path" after recovering for this session.
Warning: Duplicate directory name: C:\Program
Files\MATLAB\R2013a\toolbox\local
Warning: Initializing Handle Graphics failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup, which
should be resolved as soon as possible. Error detected was:
MATLAB:undefinedVarOrClass
Undefined variable "graphics" or class
"graphics.internal.initializeMATLABRoot".
Warning: Initializing Java preferences failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup, which
should be resolved as soon as possible. Error detected was:
MATLAB:UndefinedFunction
Undefined function 'usejava' for input arguments of type 'char'.
------- end error message ------
What is the correct way for user1 to change the path without screwing up Matlab for other users?
I presume a local pathdef.m and/or startup.m could work around this, but that would raise another issue -- this seems like poorly-designed default behavior for pathtool. Is this a bug?
cheers,
Tim

Answers (4)

Ben Pearre
Ben Pearre on 7 May 2015
Thank you for the question, and the answers! The answers look useful and expedient, and also seem like handy kludges that temporarily let us ignore a serious policy problem:
For over half a century, it has been essential multiuser policy that one user should not be able to unilaterally break another user's account--only an admin should be able to do that. Indeed, that is the ENTIRE idea of giving users their own accounts! This cannot be stated strongly enough.
If this problem exists, does it mean that I'm running Matlab with superuser permissions, and Matlab is taking liberties with my admin rights to stomp over other users? No: because other users can also screw up my account, and any rights I run with are not able to save me.
Does Matlab require superuser permissions--the ability to write system folders? It doesn't under Unix, obviously, but I had heard that Windows was multiuser now. Is it, or isn't it? If users can break each-others' configurations, then why have separate accounts?
Did I (and the OP, and a few million other users, since I just performed the default install) screw up the installation somehow??? How to correct this so that Matlab doesn't require individual users to write to shared files?
If the installer allows such a configuration (setting it up so that Matlab must run with superuser permissions--the ability to write shared folders) without warning the user and strongly recommending another configuration, then I'd argue that that's a pretty serious bug in the Matlab installer.
Did Mathworks screw this up so egregiously that it's difficult to solve? If not: I'd like to redefine the question: How to install Matlab correctly on a multiuser Windows machine?

musaozt
musaozt on 26 Mar 2018
I encounter the same error on windows10 computer with R2014a after creating a new admin user. Such a shame on matlab or windows. I did a google search and tried a few different methods. None worked. So I made my own. What worked for me was to create another security entry for the new user. Note that changing the existing ones did not help.
THE FIX:
1-Go to the folder where pathdef.m is (e.g. C:\ProgramFiles\MATLAB\R2014a\toolbox\local\ - yours might be different)
2-Right click and click properties and then go to the security tab
3-In mine, it said 'cannot show the details to the current owner' because the owner was the first account. Click 'advanced' anyways to see the advanced settings.
4- There, you will see the permissions for admin, standard accounts etc. Go ahead and click add for new one.
5-Enter your user name, allow full control and click ok. It should be good to go. You might need to restart matlab or the computer.
Hope it helps someone having the same problem. GOOD LUCK!

Sean de Wolski
Sean de Wolski on 20 May 2013
Hi Tim,
This is the purpose of userpath().
doc userpath
Using the user path allows each user to have their own path.
  1 Comment
Timothy Hilton
Timothy Hilton on 20 May 2013
I don't think userpath can accept more than one directory, correct? Our code is organized by purpose into several directories.

Sign in to comment.


Image Analyst
Image Analyst on 20 May 2013
Edited: Image Analyst on 20 May 2013
Go to that file and right click on it and select Properties, then click the Security tab. Do all groups and usernames have "Full control" checked? On my system, everyone has full control - I thought that was the default because I didn't do anything to change it.
Then right click on the Local folder itself and look at the security tab. Click on Users. Do they have full control? If not, click Edit and give them full control. On my computer they don't so I don't know why it should be necessary on yours but maybe it is. Same thing: edit then give full control.
One other thing to try. When you can't save something to a particular file, Windows will often try to let you continue by making a folder in the Virtual Store. Look for this folder: C:\Users\user1\AppData\Local\VirtualStore\Program Files\MATLAB. If it exists, delete the whole folder. Look there for other users also and delete it for them too. It will try to use that folder even after you give full control, just because it exists already. So get rid of it. With full control, it should not make that folder anymore, and your path should be being stored only in the "C:\Program Files\MATLAB\R2013a\toolbox\local\pathdef.m" folder.
See if any of that works.

Categories

Find more on Search Path in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!