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 12:45:02 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 31
Message-ID: <gv8r4e$19v$1@fred.mathworks.com>
References: <gv8nju$kvn$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 1243082702 1343 172.30.248.35 (23 May 2009 12:45:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 23 May 2009 12:45:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:541985


"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/

us