Azzera filtri
Azzera filtri

Out of memory error on 32-bit student MATLAB for Mac

2 visualizzazioni (ultimi 30 giorni)
Hi,
I am using the student version of MATLAB 2010a (32-bit) for Mac on my four core machine with 8GB of RAM. When I try to run the following commands:
omega = rand(1,20000);
time = linspace(1, 7200, 9171);
omega_matrix = time'*omega;
I get this message: "Out of memory. Type HELP MEMORY for your options."! However, when I run these same commands on another, much older machine with two cores and 4GB of RAM, the calculations are performed in a couple of seconds with no error message. The older machine has regular MATLAB 2009b (64-bit) for Mac. I am guessing that the limiting factor in my student version is the fact that it is 32-bit. Is there a way that I can modify this script to run on my 32-bit student version? Thank you very much for your assistance.
Regards,
Martin
  4 Commenti
Walter Roberson
Walter Roberson il 25 Feb 2011
You are attempting to construct a matrix that is 20000 by 9171 by 8 bytes per entry. That is just under 1.4 gigabytes. I do not know what the effective limit is for the Mac 32 bit version is, but it is probably not more than a gigabyte.
It might or might not be more time efficient to use
omega_matrix = bsxfun(@times, time', omega)
but the output space would still be the same.
In order to run the script you will need to reduce the number of omega being generated, or the number of time steps.
On the other hand, since the omega_matrix will have such a regular structure, there is a possibility that you could rewrite the code that comes afterward so that it does not need the omega_matrix to be stored at all: you can rewrite the array omega_matrix indexed at the simple indexes (I,J) as:
omega_matrix = @(J,K) time(J) .* omega(K)
Martin
Martin il 8 Mar 2011
Thank you for your suggestions. Unfortunately, I need the entire matrix at once to generate a very large number of simulated points by matrix - vector multiplication, rather than using a for loop. I will use 'single' to save memory, or switch to 64 - bit.

Accedi per commentare.

Risposta accettata

Andreas Goser
Andreas Goser il 25 Feb 2011
Try
omega = rand(1,20000,'single');
time = linspace(single(1), single(7200), 9171);
omega_matrix = time'*omega;
That saves a lot of memory

Più risposte (1)

Jan
Jan il 25 Feb 2011
You can ask COMPUTER for the maximum number of elements in an array also:
[C, MaxSize] = computer

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by