Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Preallocation in MATLAB R2009a
Date: Wed, 5 Aug 2009 18:15:21 +0000 (UTC)
Organization: Mitre Corp
Lines: 37
Message-ID: <h5ci7p$2hn$1@fred.mathworks.com>
References: <h5c475$639$1@fred.mathworks.com> <h5cap2$6e9$1@fred.mathworks.com> <h5cekt$3nt$1@fred.mathworks.com> <h5cfp2$hes$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1249496121 2615 172.30.248.38 (5 Aug 2009 18:15:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 5 Aug 2009 18:15:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2318
Xref: news.mathworks.com comp.soft-sys.matlab:561087


"Steven Lord" <slord@mathworks.com> wrote in message <h5cfp2$hes$1@fred.mathworks.com>...
> 
> "someone" <someone@somewhere.net> wrote in message 
> news:h5cekt$3nt$1@fred.mathworks.com...
> 
> *snip*
> 
> > I would like to make one observation here.
> > If you assume that b in the above code will
> > result in matrix filled with zeros, then you are
> > relying on an "undocumented" feature.
> >
> > Whos to say what might happen in future MATLAB releases?
> > Maybe b will be filled with NaNs execpt for b(10000,10000).
> 
> Actually, this behavior is documented.  Look at the last example in the 
> "Adding Smaller Blocks to a Matrix" subsection on this page from the 
> documentation:
> 
> http://www.mathworks.com/access/helpdesk/help/techdoc/math/f1-85766.html
> 
> Changing the "fill in" value would be a MAJOR backwards incompatibility, so 
> it's highly unlikely we'd make that change.  If we did decide to make a 
> change like that, it would be called out in bold red flashing letters in the 
> Release Notes, in several sections of the documentation, and probably in 
> several other ways.
> 
> -- 
> Steve Lord
> slord@mathworks.com 
> 

Nice to know, didn't realize that!
But then again, there IS a difference between 
what is "highly unlikely" and what is "guaranteed".
It would be VERY disturbing if zeros(m,n) returned 
anything except a matrix filled with zeros.