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

5 visualizzazioni (ultimi 30 giorni)
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

Risposte (8)

Jonathan Currie
Jonathan Currie il 4 Mag 2013
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 il 25 Ott 2012
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 il 23 Mar 2013
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 il 29 Mar 2014
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 il 28 Nov 2012
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 Commento
Jan
Jan il 4 Mag 2013
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.

Accedi per commentare.


Jan
Jan il 4 Mag 2013
Modificato: Jan il 4 Mag 2013
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 Commento
Oleg Konings
Oleg Konings il 10 Giu 2014
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.

Accedi per commentare.


Knut
Knut il 7 Mag 2013
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 Commento
Pol Henarejos
Pol Henarejos il 13 Mag 2013
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.

Accedi per commentare.


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

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by