Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Preallocate when you don't know the size of a matrix
Date: Fri, 20 May 2011 16:09:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 4
Message-ID: <ir63n1$55g$1@newscl01ah.mathworks.com>
References: <ir636l$3pm$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1305907745 5296 172.30.248.46 (20 May 2011 16:09:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 20 May 2011 16:09:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1895050
Xref: news.mathworks.com comp.soft-sys.matlab:727892

"Javier " <javsanzperez@gmail.com> wrote in message <ir636l$3pm$1@newscl01ah.mathworks.com>...
> Hi, I'm going to fill a matrix but I don't have any idea of its final size. Is it efficient to preallocate with zeros (X,X) being X a large number and then delete the zeros that stay?  Thank you!

Could you give a little more detail, and possibly some sample code?  Depending on the setup, a cell array might make sense.  Or if you have R2011a, it might not matter (since they did some optimization in the non-preallocated case).  But we need more info than what you've given us.