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 17:41:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <h5cg7f$h6m$1@fred.mathworks.com>
References: <h5c475$639$1@fred.mathworks.com> <h5cap2$6e9$1@fred.mathworks.com> <h5cekt$3nt$1@fred.mathworks.com> <h5cfn2$dh7$1@fred.mathworks.com> <h5cfv8$hl$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1249494063 17622 172.30.248.35 (5 Aug 2009 17:41:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 5 Aug 2009 17:41:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1886545
Xref: news.mathworks.com comp.soft-sys.matlab:561076


"Steven Lord" <slord@mathworks.com> wrote in message <h5cfv8$hl$1@fred.mathworks.com>...
> 
> "Oleg Komarov" <oleg.komarov@hotmail.it> wrote in message 
> news:h5cfn2$dh7$1@fred.mathworks.com...
> 
> *snip*
> 
> > a = ones(2,2)
> > b(2,2) = 1
> > a =
> >     1     1
> >     1     1
> > b =
> >     0     0
> >     0     1
> >
> > Lets say now it makes sense. has Yair Altman ever mentioned this?
> 
> Why would he?  If you assign a value to an element beyond the bounds of the 
> matrix, the elements that need to be created to perform that assignment 
> while keeping the matrix rectangular are filled in with 0's.  Note the 
> difference between:
> 
> a = ones(2, 2)
> b1(2, 2) = 1
> 
> and:
> 
> a = ones(2, 2)
> b2(1:2, 1:2) = 1
> 
> -- 
> Steve Lord
> slord@mathworks.com 
> 
I feel like a beginner. Thanks for the reference S. Lord!