Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Comma list with leading cell
Date: Sat, 23 May 2009 12:59:02 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 52
Message-ID: <gv8rum$lea$1@fred.mathworks.com>
References: <gv8nju$kvn$1@fred.mathworks.com> <gv8r4e$19v$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
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 1243083542 21962 172.30.248.38 (23 May 2009 12:59:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 23 May 2009 12:59:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:541987


"us " <us@neurol.unizh.ch> wrote in message <gv8r4e$19v$1@fred.mathworks.com>...
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gv8nju$kvn$1@fred.mathworks.com>...
> > This syntax works it is beyond my expectation! Is it documented somewhere?
> >  
> > >> [{} 1 2 3]
> > 
> > ans = 
> > 
> >     [1]    [2]    [3]
> > 
> > % To me the correct syntax is
> > 
> > >> [{} {1 2 3}]
> > 
> > Bruno
> 
> it is a weel known fact of ML life
> 
> ...
> When MATLAB sees a subscripted assignment to an existing variable, MATLAB checks the class of the right-hand-side against the class of the left-hand-side (LHS) variable. If different, it attempts to convert the right-hand-side (RHS) variable to the type of the LHS class.
> ...
> 
>      ['a' nan]
>      [uint8(1) pi]
>      [pi uint8(1)]
> 
> here some of the tech docs this is referred to
> 
> http://www.mathworks.com/support/solutions/en/data/1-6K5PAO/
> http://www.mathworks.com/support/solutions/en/data/1-6K5PAO/
> 

Humm it is clearer but not perfect, because why this doesn't work:

>> a={1}

a = 

    [1]

>> class(a)

ans =

cell

>> a(1)=2
??? Conversion to cell from double is not possible.

I'm still confused. It seems the example I gave above Matlab succeeds to convert somehow double to cell? Why now it can't.

Bruno