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.
No products are associated with this question.
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.
I had the same exact problem. My solution:
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.
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
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?
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...
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.
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!