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 19:05:02 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 39
Message-ID: <gv9hcu$3s3$1@fred.mathworks.com>
References: <gv8nju$kvn$1@fred.mathworks.com> <gv8r4e$19v$1@fred.mathworks.com> <gv8rum$lea$1@fred.mathworks.com> <gv8th9$166$1@fred.mathworks.com> <gv8v05$355$1@fred.mathworks.com> <gv907h$jee$1@fred.mathworks.com> <gv92gl$ce4$1@fred.mathworks.com> <gv9455$m63$1@fred.mathworks.com> <gv9536$jgf$1@fred.mathworks.com> <gv95rh$73o$1@fred.mathworks.com> <gv96g6$gvu$1@fred.mathworks.com> <gv984l$s21$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 1243105502 3971 172.30.248.38 (23 May 2009 19:05:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 23 May 2009 19:05:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:542059

What bother me usr is this. When we type

[1:3 4 5]

it gave the array of 1 to 5.

Now, what happens if I do

[1:3 4 {} 5]

Because of the presence of {}, Matlab will interpret (or CAST or what whatever the right world)

1:3 -> {1:3}
4 -> {4}
5 -> {5}

So it looks like MATLAB is able to convert DOUBLE array to CELL array implicitly in this build.

So when I type

>> C = {1}
>> C(1) = 2

I would expect it behaves a little bit like 

>> C=uint8(1)
>> C(1) = pi

where cast from DOUBLE to INT8 is carried out.

I know that MATLAB *can* cast from class DOUBLE to CELL (while building an array), but not here: it flushes me out with the error message. To me this is an inconsistent in MATLAB behavior.

And I agree with Matt, from many documents you have showed, none of them address this behavior, even that you think the contrary.

Anyway, I might change my opinion later, but for now I'm not yet convinced.

Thanks, it was a good discussion.

Bruno