1- check what you have
2- To check the version of your Java, type the following in the Matlab prompt window:
version -java
3- to check the current size you have type:
java.lang.Runtime.getRuntime.maxMemory
java.lang.Runtime.getRuntime.totalMemory
java.lang.Runtime.getRuntime.freeMemory
To Solve it:
4-open a text file
5- write the following in it
For JVM of 1.2.2 and later, place the following in your java.opts file:
-Xmx256m
For JVM 1.1.8 'java.opts', place the following in your java.opts file:
-mx256m
6- Save the file with the following name:
java.opts
7- you can simply put a number more than 256 if your machine allow it for example (Xms512m)
8- Save the file in the matlab path directory
Simply will work :)
some people increase it from the cmd for dos like this,
- java -Xms64m -Xmx256m
I am not sure if this works, but the method I just described works for sure :)