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$>
References: <gv8nju$kvn$> <gv8r4e$19v$> <gv8rum$lea$> <gv8th9$166$> <gv8v05$355$> <gv907h$jee$> <gv92gl$ce4$> <gv9455$m63$> <gv9536$jgf$> <gv95rh$73o$> <gv96g6$gvu$> <gv984l$s21$>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1243105502 3971 (23 May 2009 19:05:02 GMT)
NNTP-Posting-Date: Sat, 23 May 2009 19:05:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: 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.