I can confirm this for R2009a/64/Win7. I've pasted it as multiple lines.
I have opened a new M-file in the editor. Then I've opened the same file using WordPad and inserted the code there. After saving Matlab's editor updated its display and Matlab crashed again. Re-opening Matlab did not crash, but leaves the editor window open. The last semi-colon of the pasted code is marked by M-Lint with the warning:
An M-Lint problem analyzing this file caused your previous MATLAB session to terminate unexpectedly.
(Very interesting. I'm curious where Matlab stores this information!)
Now I've created an M-Lint report for the file and I got 1440 messages about the usage of "i" and "j" as variables. Finally I've replaced them by "ii" and "jj", copied it and pasted the block to a new file - and Matlab crashed again.
Besides the obvious method to upgrade your Matlab, I suggest to use a less brute way of programming. I boldly claim without a even trying it: This function will be very slow.
Best Answer