MATLAB: Out of memory error

help memoryMATLABmemory errorout of memory

I'm running a long and complex program for data analysis that runs perfectly fine on a colleague's computer.
However, when I try to run it, I get the following error:
??? Out of memory. Type HELP MEMORY for your options.
Error in ==> NonRephasingC16_120 at 216
SR(tn,:,:)=SS;
(the last line is the line of code in which it apparently breaks, NonRephasingC16_120 is the name of the program.)
Typing "HELP MEMORY" yields that I should run the "memory" command, which gives the following results:
>> memory
Maximum possible array: 148 MB (1.555e+008 bytes) *
Memory available for all arrays: 822 MB (8.624e+008 bytes) **
Memory used by MATLAB: 889 MB (9.319e+008 bytes)
Physical Memory (RAM): 3571 MB (3.745e+009 bytes)
* Limited by contiguous virtual address space available.
** Limited by virtual address space available.
I've tried the pack command and closing all other programs on the computer. I've also attempted to mess with the code to see if I can make the offending array smaller, but it does not look like it can be done. Yes, we are certain that the program being run is identical.
Is there some kind of setting I can change, either in Matlab or on my computer, that will enable it to run properly? If I have to get a new computer, what parameter would help this to run well?
I'm currently running windows 7, as is my coworker who can run the program. My computer is a dell optiplex 980. Matlab version is 7.11.0(R2010b)

Best Answer

You might just be out of memory. You appear to be using a 32 bit version of MATLAB, are so are being limited by the fact that MS Windows can give 32 bit processes at most 3.0 Gigabytes of memory, and even then can only give that much memory if a special boot-time flag was given.
If you were able to switch to a 64 bit version of memory on a 64 bit operating system on the same computer, then you would be able to configure your system to add swap space that your MATLAB program could use. This would, however, probably be rather slow.
Better would be to get a computer with more memory and 64 bit Windows and a 64 bit version of MATLAB.
It is possible that your system does have enough memory to store the matrix (but would probably fail to try to use the matrix.) The line
SR(tn,:,:)=SS;
being the problem hints to me that the software is not pre-allocating all of the memory to store the data. When you do not pre-allocate an output matrix, then each time you go to grow the output matrix, it needs to take a copy of the data, which temporarily duplicates the data in memory, possibly filing up memory. If the code had done something like
SR = zeros(83, 640, 480); %but with appropriate sizes!
ahead of time then that problem would not occur.