Path: news.mathworks.com!not-for-mail
From: Loren Shure <loren@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: overcoming the limit of repmat
Date: Wed, 7 May 2008 08:06:00 -0400
Organization: The MathWorks
Lines: 45
Message-ID: <MPG.228b652f7cdd668e98984f@news.mathworks.com>
References: <fvr8g7$sep$1@fred.mathworks.com> <fvr9lm$nkk$1@fred.mathworks.com>
NNTP-Posting-Host: shurel.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1210161960 14564 172.31.57.117 (7 May 2008 12:06:00 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 7 May 2008 12:06:00 +0000 (UTC)
User-Agent: MicroPlanet-Gravity/2.70.2067
Xref: news.mathworks.com comp.soft-sys.matlab:467148


In article <fvr9lm$nkk$1@fred.mathworks.com>, spamless@nospam.com 
says...
> "Sourav Roy" <souravroy1@rediffmail.com> wrote in message 
> <fvr8g7$sep$1@fred.mathworks.com>...
> > Hi,
> > I tried the below code :- 
> > >> z = rand(1,(666),10000);
> > >> x = repmat(z,300,1);
> > 
> > The code gave the below error:- 
> > 
> > ??? Maximum variable size allowed by the program is 
> > exceeded.
> > 
> > Error in ==> repmat at 97
> >     B = A(subs{:});
> > 
> > While this one worked, 
> > 
> > >> ab = z(:,:,1);
> > >> z = rand(1,(666),100);
> > >> x = repmat(z,300,1);
> > 
> > Kindly suggest how I can overcome this.
> 
> You are trying to create a 300-by-666-by-10000 matrix of 
> double precision (8 byte) values.  This requires 
> 300*666*10000*8/1024^3 = 14.88 GB of memory.  It ain't 
> gonna happen with 32-bit MATLAB.  Check out the following 
> technical note:
> 
> http://www.mathworks.com/support/tech-notes/1100/1106.html
> 
> Get 64-bit MATLAB and a 64-bit machine.
> 
> By the way... love the tags "matlab" and "code".
> 
> 
> 

Depending on what you are ultimately trying to achieve, you might be 
able to circumvent repmat and still get useful results using bsxfun.
-- 
Loren
http://blogs.mathworks.com/loren/