Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Matlab Memory Error Using zeros(9764,9764)

Subject: Matlab Memory Error Using zeros(9764,9764)

From: Raja Thappetaobula

Date: 3 Jul, 2008 14:50:03

Message: 1 of 4

Hi,

I am getting Out Of Memory Error when i define a variable
Zeros(nvar,nvar) where my nvar=9764

What is my solution



Thanks

Raja

Subject: Matlab Memory Error Using zeros(9764,9764)

From: Matt Fig

Date: 3 Jul, 2008 15:22:01

Message: 2 of 4

Reduce the size of nvar.

Subject: Matlab Memory Error Using zeros(9764,9764)

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 3 Jul, 2008 16:11:05

Message: 3 of 4

In article <g4iour$mbf$1@fred.mathworks.com>,
Raja Thappetaobula <thappeta@hotmail.com> wrote:

>I am getting Out Of Memory Error when i define a variable
>Zeros(nvar,nvar) where my nvar=9764

>What is my solution

http://matlabwiki.mathworks.com/MATLAB_FAQ#How_do_I_fix_22Out_of_Memory.22_problems.3F
--
  "The art of storytelling is reaching its end because the epic
  side of truth, wisdom, is dying out." -- Walter Benjamin

Subject: Matlab Memory Error Using zeros(9764,9764)

From: rodney.thomson@gmail.com

Date: 4 Jul, 2008 02:57:47

Message: 4 of 4

On Jul 4, 12:11=A0am, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
wrote:
> In article <g4iour$mb...@fred.mathworks.com>,
>
> Raja Thappetaobula <thapp...@hotmail.com> wrote:
> >I am getting Out Of Memory Error when i define a variable
> >Zeros(nvar,nvar) where my nvar=3D9764
> >What is my solution
>
> http://matlabwiki.mathworks.com/MATLAB_FAQ#How_do_I_fix_22Out_of_Memo...
> --
> =A0 "The art of storytelling is reaching its end because the epic
> =A0 side of truth, wisdom, is dying out." =A0 =A0 =A0 -- Walter Benjamin

You are trying to create an array which will use up approximately 762
megabytes. Now you might think you have that much memory on your
machine, but here is the other thing, that memory need to be a
contiguous chunk of memory.

One thing you can attempt to do is reduce the size of each element in
your array. By default zeros will return you arrays of double
precision variables, ie 8 bytes per element.

If you are storing only 256 shades of grey (for a B/W image for
example) then you can afford to use a single byte to store this
information!

ie :
data =3D zeros(9764, 9764, 'int8');

data will be only be 1/8th the size (< 100 MB).

--
http://iheartmatlab.blogspot.com

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics