Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: cell array size
Date: Mon, 11 Aug 2008 03:40:04 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 19
Message-ID: <g7ocak$4to$1@fred.mathworks.com>
References: <g7o91i$add$1@fred.mathworks.com> <g7o9ie$dnh$1@fred.mathworks.com> <g7obrj$p41$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1218426004 5048 172.30.248.38 (11 Aug 2008 03:40:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 11 Aug 2008 03:40:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com comp.soft-sys.matlab:484808



A = {[1,2]
[1,2,3]
[1,2,3,4]
[1,2,3,4,5]
[1,2,3,4,5,6]}


You COULD do this in a loop:

lngth = zeros(length(A),1); % Preallocate
for kk = 1:length(A)
    lngth(kk) = length(A{kk});
end



Or you could just use:

cellfun(@length,A)