MATLAB Answers

2

Why do I receive a warning regarding missing pathdef.m when starting MATLAB 7.14 (R2012a)?

I just finished the MATLAB installation, but when starting MATLAB I receive the following warnings and cannot execute any command:
Warning: C:\Program Files\MATLAB\R2012a\toolbox\local\pathdef.m not found.
Toolbox Path Cache is not being used. Type 'help toolbox_path_cache' for more info Undefined function or variable 'ispc'.
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\R2012a\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'.
> In matlabrc at 113
Warning: Failed to add default profiler filters.
> In matlabrc at 168

4 Answers

Answer by MathWorks Support Team on 18 Oct 2013
 Accepted Answer

This issue was previously due to a bug that has been fixed in Release 2013a (R2013a). For previous product releases, read below for any possible workarounds:
In order for MATLAB to execute a command, the file that contains the code for that command must be stored in a folder that is on the MATLAB search path. The MATLAB search path is just a list of folders on your file system. Each time MATLAB launches, that list is repopulated with the help of the file "pathdef.m". These warnings occur because the file "pathdef.m" was not created during installation.
To resolve the issue, follow these steps:
1) Start MATLAB as an administrator.
2) In the MATLAB Desktop interface, locate the address field of the Current Folder browser, in which you can enter a path to change your current working directory.
3) Enter "$MATLABROOT\toolbox\local\" in the address field, where $MATLABROOT should be replaced with the location where MATLAB is installed. On Windows, this is typically in a folder such as:
C:\Program Files\MATLAB\R2012a
On Mac OS X, this is typically:
/Applications/MATLAB_R2012a.app
For example, if I am using MATLAB R2012a on Mac OS X, in the address bar, I would enter:
/Applications/MATLAB_R2012a.app/toolbox/local
4) At the MATLAB Command Window, execute the following commands:
restoredefaultpath;
matlabrc
savepath
These commands will cause a new file, "pathdef.m", to be created.
You should now be able to relaunch MATLAB without seeing those warning messages, and you should be able to execute commands at the MATLAB Command Window.
If the issue is not resolved, try creating the "pathdef.m" file on your desktop by replacing the "savepath" command above with a command such as:
savepath C:\Users\myusername\Desktop\pathdef.m
You can now manually copy that "pathdef.m" file from your desktop into $MATLABROOT\toolbox\local.

  6 Comments

I wholeheartedly agree with Ben Pearre. We are experiencing the same problem with R2016b on a multi-user system in our company network. Due to this issue, it is impossible to use Matlab in a professional Windows Domain environment.
Could you please solve this problem?
Thanks a lot in advance.
Could someone from Mathworks please respond to Ben and Jorg's comments please?
This is a major design flaw and needs addressing as a matter of urgency.
Thanks, John
I had a similar problem in R2018A under Windows 10. I am logged in as a user with administrator privileges.
I followed the directions in the answer and it appears to have fixed my problems.

Sign in to comment.


Answer by Nicola Pesavento on 2 May 2017

Same problem here (Matlab R2016b in multi-user system, updated Windows 10)! Can Mathworks fix this issue?

  1 Comment

If "pathdef.m" file is authorized, it can not be read in binary form from other accounts.
Re-installing in a non-privileged location may help.

Sign in to comment.


Answer by Eric Thim on 25 Jul 2017

Same problem with Matlab 2016b on multi-user system on Windows 7. Mathworks, please respond the this issue that multiple people are having.

  0 Comments

Sign in to comment.


Answer by Gabor Gubicza on 16 Jan 2018

I assume I have the same problem. Please be so kind to address the issue. Thank you.

  0 Comments

Sign in to comment.