Error in getDefaultUserFolder at MATLAB startup

26 Ansichten (letzte 30 Tage)
Marcus Björk
Marcus Björk am 31 Mai 2012
After a fresh install of 2012a I was welcomed by the following message:
Cannot find function, getDefaultUserFolder, in library services.
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
Meaning that no paths was added and no MATLAB functions could be used. "restoredefaultpath" did make functions usable but gave warnings about duplicate directories. And matlabrc still gave warnings too. After restoring and saving the path, a reboot of MATLAB gave the same message. Even reinstalling MATLAB did not help.
At first everything was hopeless and it seemed nobody else had ever experienced this (from a google search). Has anybody else had this problem but not written about it?
I managed to find a solution finally, so I figured I should post it somehow. I guess an answer to my own question is the best way.

Akzeptierte Antwort

Marcus Björk
Marcus Björk am 31 Mai 2012
So to the answer (skip to summary for quick solve). I figured there was something wrong with the user path since the first error mentioned this. The rest was probably only secondary failure.
In pathdef which is used by matlabrc userpath.m is called and inside user.m the call system_dependent('getuserworkfolder'); caused the message: "Cannot find function, getDefaultUserFolder, in library services." So setting the default path was a problem. I figured since you can change the user path it has to be stored somewhere, which turned out to be in AppData\Roaming\MathWorks\MATLAB\R2012a\matlab.settings (in win7). However the value is not stored there unless it has been changed it seems. But looking at the matlab.settings on a working installation, I could copy in a specified "userpath" value. This solved the problem! Hope this can help someone.
Summary:
change the userpath value maually in AppData\Roaming\MathWorks\MATLAB\R2012a\matlab.settings (or corresponding) to (or insert if missing):
<settings name="matlab" .....................................................>
<key name="UserPath">
<value><![CDATA[C:\Users\**\Documents\MATLAB]]></value>
</key>
or whatever user path you prefer (the dots correspond to some text I left out). Start MATLAB, enjoy.
  7 Kommentare
Walter Roberson
Walter Roberson am 4 Aug. 2017
It is a text file. Open it with any text editor. If you need to, temporarily rename it to a file extension that your text editor will accept.
Divyashree Tumakuru Ramesh
Divyashree Tumakuru Ramesh am 24 Mär. 2021
I am facing similar issue, when i opened the path, I have path only till AppData\Roaming\MathWorks\MATLAB\R2016b\ matlab.setting file is missing, how do i access that.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by