Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Comma list with leading cell
Date: Sat, 23 May 2009 13:41:01 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 33
Message-ID: <gv8udd$pdc$1@fred.mathworks.com>
References: <gv8nju$kvn$1@fred.mathworks.com> <gv8r4e$19v$1@fred.mathworks.com> <gv8s49$2ua$1@fred.mathworks.com> <gv8t0d$rm7$1@fred.mathworks.com> <gv8tl1$81o$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 1243086061 26028 172.30.248.35 (23 May 2009 13:41:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 23 May 2009 13:41:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:541996


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gv8tl1$81o$1@fred.mathworks.com>...
> "us " <us@neurol.unizh.ch> wrote in message <gv8t0d$rm7$1@fred.mathworks.com>...
> 
> > 
> > http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/br04cfa-1.html
> > 
> 
> But us, let us reiterate the question. Why conversion from double to cell
> 
> C = {1};
> C(1) = 2
> 
> is not allowed?
> 
> Bruno

well, as the above mentioned doc says
...
Matrices and arrays can be composed of elements of most any MATLAB data type as long as all elements in the matrix are of the same type. If you do include elements of unlike classes when constructing a matrix, MATLAB converts some elements so that all elements of the resulting matrix are of the same type. 
...
that's the WITHIN rule DURING construction of a matrix when nothing is known about it, yet...

again

     r=[{} 1 2 3];

1) construct the matrix = WITHIN:     [{} 1 2 3];
2) assign the matrix = BETWEEN: r = ANS
   in this case: r has NO subscripts, so it is just the ans...
   if, however, the lhs comes with subscripts, ML checks for consistency
   BETWEEN the two (lhs = rhs) containers...

urs