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

조회 수: 5 (최근 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

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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by