MATLAB: How to increase memory and max array length!

image processingMATLABmemoryout of memory

Hi,
I'm trying to process MRI images in MATLAB, but when I try to execute this line:
T1_h = h1_aux'*ones(1,2^16);
where h1_aux is (2^16,1) so that the result T1_h should be a [2^16 x 2^16] 'double' matrix, MATLAB runs out of memory:
??? Out of memory. Type HELP MEMORY for your options.
since the number of elements in largest real double array is 2^{48}-1 (~2.8e14) for mi 64-bit Windows 7 running 64-bit MATLAB R2010b
And this is what I get when I type the 'memory' command at this point of execution:
>> memory
Maximum possible array: 12297 MB (1.289e+010 bytes) *
Memory available for all arrays: 12297 MB (1.289e+010 bytes) *
Memory used by MATLAB: 973 MB (1.020e+009 bytes)
Physical Memory (RAM): 8173 MB (8.570e+009 bytes)
* Limited by System Memory (physical + swap file) available.
Due to the algorithm that I'm implementing, I cannot break this matrix into smaller ones to process them separately.
How can I increase the memory to increase the length of the arrays and avoid this message?
Thank you.
Angel TC.

Best Answer

Buy more RAM. By my calculation, a 2^16x2^16 matrix of doubles would require 32 GB of RAM. Chances are you'll be making at least 1 more matrix during you computations that is this size. And in some additional RAM for your system to use, and your are talking ~68 GB of RAM.
Related Question