MATLAB will not start up after several crashes due to a bad MEX file

3 ビュー (過去 30 日間)
AP
AP 2012 年 10 月 25 日
コメント済み: Rahul Choure 2015 年 11 月 18 日
Dear All,
I was debugging my MEX file because of a bug in the code. Each time the code runs, MATLAB crashes. I think it was after 3-4 times crashing that MATLAB did not start up at all. MATLAB splash screen loads and will disappear after a second but MATLAB interface does not start. Even restarting the computer does not help. Does someone know why this happens? It's disappointing because I have a project due.
I am using MATLAB 2012b, Windows 7 x64, and Visual Studio 2008.
Thanks,
Ahmad

回答 (8 件)

Jonathan Currie
Jonathan Currie 2013 年 5 月 4 日
I develop a lot of MEX files (and thus crashes happen fairly frequently) and had this issue on every version of MATLAB (32bit and 64bit) since about 2009a (when I first started developing). I often go through cycles of uninstalling and re-installing MATLAB until eventually it works again. Sometimes reinstalling the JRE helps, sometimes not.
This is a real pain and it would be good if MathWorks could sort it out. Currently fighting 2013a 64bit and up to 5th reinstall, wiping the AppData folder each time and reinstalled JRE a number of times...

Andreas Goser
Andreas Goser 2012 年 10 月 25 日
You can try deleting (or better renaming so that you be reuse old prefences later) the preference directory. Find the matlab.prf file on your machine to find the directory.
When you rename the directory, you keep all old files and MATLAB created ne default one when starting.

Michael Litvin
Michael Litvin 2013 年 3 月 23 日
I had the same exact problem. My solution:
  • Go to C:\Program Files\MATLAB\R2012b\sys\java\jre\win64
  • Rename 'jre' folder (the inner one, jre\win64\jre->jre\win64\jre_bck)
  • Install a newer version of JRE (I have 1.7.0_10 64bit)
  • Create a symbolic link from C:\Program Files\Java\jre7 to C:\Program Files\MATLAB\R2012b\sys\java\jre\win64\jre
That's it.

Jan Berling
Jan Berling 2014 年 3 月 29 日
I had the same problem.
I removed the appdata like Andreas Goser suggested and also reinstalled the JRE, as suggested by Jonathan Currie.
What worked for me now, was to open Matlab with the -nojvm option enabled. e.g.
"...\bin\matlab.exe" -nojvm
After that I could start Matlab normally.
Maybe one start with -nojvm is enough, without the need to remove the appdata or reinstall the JRE. #bestpractices
  1 件のコメント
Denis Anikiev
Denis Anikiev 2014 年 4 月 6 日
Great, thanks, it worked at MATLAB2012a win64 as well.

サインインしてコメントする。


Chad Gilbert
Chad Gilbert 2012 年 11 月 28 日
I've suffered this exact same issue recently. I had to remove my entire "C:\Users\<user>\AppData\Roaming\MathWorks\MATLAB" directory before I was able to re-start MATLAB. This allowed me to boot up MATLAB again, but wreaked havoc on one of my toolboxes.
Has anyone managed to locate more precisely, the configuration issue that these crashes are causing? Have any tips for avoiding similar issues in the future, when using a lot of MEX files?
  1 件のコメント
Jan
Jan 2013 年 5 月 4 日
You cannot avoid that a mad MEX function destroyed important information. But a simple backup can decrease the effort required to make the system working again. Therefore I've created a copy of my prefdir folder.

サインインしてコメントする。


Jan
Jan 2013 年 5 月 4 日
編集済み: Jan 2013 年 5 月 4 日
This is actually a comment to Jonathan Currie's answer, but perhaps it is worth to be written as answer also:
I have created about 200 C-Mex functions in the last 14 years for different Matlab versions also. Therefore I'm familiar with ugly crashes also. While I never had to reinstall Java -and it is not clear to me how a C-function could confuse the JRE at all-, I had corrupted preferences sometimes also. After the first time I've created a backup copy of the prefdir folder, such that I did not need time-consuming uninstall/re-install of Matlab. Deleting the preferences worked for me also.
What could be the reason for a destroyed JRE?
In some cases I had to run restoredefaultpath. This was caused by shadowing built-in functions with a crashing replacement, but this would happen for buggy M-files also.
  1 件のコメント
Oleg Konings
Oleg Konings 2014 年 6 月 10 日
I am having a similar problem. MATLAB 2012b will start (at least it appears in the Task Manager as being active) but the GUI never appears. This happened after profiling a CUDA mex file via Nvidia NVVP. There were no crashes during/after profiliong, and I have been using this set of tools for over a year with no problems.
Have tried all the suggestions in this thread, other than re-installation, which I would like to avoid.
Assuming it was the mex which caused the issue, what can be done?
Windows 7 64 bit, MATLAB 2012b, no issues at all until this point.

サインインしてコメントする。


Knut
Knut 2013 年 5 月 7 日
Answer to Michael:
You could also do the following, suggested by Matlab Error-report itself: "...Please check if you have a MATLAB_JAVA environment variable..."
Set the system variable: MATLAB_JAVA = C:\Program Files\Java\jre7 (the current Java7 x64 installation folder)
For us it worked fine!
  1 件のコメント
Pol Henarejos
Pol Henarejos 2013 年 5 月 13 日
I had the same problem and your solution worked for me. However, now I see the system font in bold and hence all fonts in the matlab window are in bold.

サインインしてコメントする。


Jan Hermann
Jan Hermann 2015 年 3 月 20 日
Had the same problem on OS X with R2014a. In my case, the concerned file was ~/.matlab/R2014a/MATLABDesktop.xml.

カテゴリ

Help Center および File ExchangeInstall Products についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by