MATLAB Answers

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

165 views (last 30 days)
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:
Undefined variable "graphics" or class
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:
Undefined function 'usejava' for input arguments of type 'char'.
> In matlabrc at 113
Warning: Failed to add default profiler filters.
> In matlabrc at 168

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
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:
For example, if I am using MATLAB R2012a on Mac OS X, in the address bar, I would enter:
4) At the MATLAB Command Window, execute the following commands:
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.
Robert White
Robert White on 13 Dec 2018
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.

More Answers (3)

Nicola Pesavento
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
Takafumi on 18 Mar 2019
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.

Eric Thim
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.

Community Treasure Hunt

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

Start Hunting!