Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Preallocation in MATLAB R2009a
Date: Wed, 5 Aug 2009 18:08:04 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 9
Message-ID: <h5chq4$3nt$1@fred.mathworks.com>
References: <h5c475$639$1@fred.mathworks.com> <h5c9nq$fsm$1@fred.mathworks.com> <h5cgs2$52$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1249495684 3837 172.30.248.37 (5 Aug 2009 18:08:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 5 Aug 2009 18:08:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:561086



> 
> Thank U very much&#65281;
> Maybe I didn't make it clear, my puzzle is what result in the  huge speed difference between "a = zeros(m,n)" and "a(m,n)= 0",since zeros is a built-in function and has good efficience.
> I'm guessing "a(m,n) = 0" just do a few things like labeling the beginning and end of the variable in memory, since free memory space are all 0s.

No, I don't believe. My theory is simply poor programming of ZEROS function. Oh well. Good to know though.

Bruno