Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <brunoluong@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Bug in mat2cell?
Date: Sun, 25 Nov 2007 12:16:14 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <fibp2d$sff$1@fred.mathworks.com>
References: <fibjt3$64b$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <brunoluong@yahoo.com>
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 1195992974 29167 172.30.248.38 (25 Nov 2007 12:16:14 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 25 Nov 2007 12:16:14 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1184112
Xref: news.mathworks.com comp.soft-sys.matlab:439239



I look at the Mathworks's mat2cell code, and at the line
#198, the array ref is updated under certain condition:

...
if (inc~=1) && ~(cellsize(1)==1)
    [ref{1:inc-1}] = deal(refstart{1:inc-1});
    refstatic(1:inc-1) = 0;
end
...

The condition ~(cellsize(1)==1) seems to cause the Bug. If I
remove it from the test, as following:

...
if (inc~=1)
    [ref{1:inc-1}] = deal(refstart{1:inc-1});
    refstatic(1:inc-1) = 0;
end
...

it works. I'm not sure what is the test on cellsize(1) is
for, and I'm not sure I would introduce a mess in mat2cell
function by removing it. Hope someone at mathworks could
answer the question.

Bruno