I just spent the day trying to figure out why Matlab was locking up and not responding. It turns out that deleting a large data file solved the problem, but I am wondering if anyone can explain what is happening.
Here is the series of events:
I was running some simulations and collecting data in data structures in the Matlab base workspace. After a while, I notice that Matlab is slowing down, and I figure that it is getting low on resources, since these data structures are quite large. So, I attempt to save the data and figure out how I can reduce the size of the simulation output. I type the command:
save ('TrajData.m' , 'Struct1', 'Struct2', ...
(there are a total of 6 or 8 data structures) At this point, Matlab locked up. (I immediately noticed that I specified '.m' rather than '.mat', so I am wondering if this had any impact on what happened.) Now Matlab is hung up, and will not respond. I don't even have access to the task manager on this system, so the only way I can kill the process is by restarting the computer. At this point, when I restart Matlab, it immediately hangs up while the status bar says "initializing...". Once again, it is completely non-responsive. After much fumbling around, I discover that deleting all of the files in the Matlab folder allows the program to start and run normally. As I am copying my original files back to the Matlab folder (with the Matlab window open), as soon as I copy the TrajData.m file, Matlab hangs up and throws a full screen of red error text, something to the effect of "out of memory". The TrajData.m file is just over 1GB in size. I am running Matlab R2015b, (the same occurs with 2016b) on a windows NT6.2 system with 8GB ram.
So, why does Matlab immediately lock-up when this file is copied to the Matlab folder?