Path: news.mathworks.com!not-for-mail
From: "Donn Shull" <donn.shull.no_spam@aetoolbox.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: cell array size
Date: Mon, 18 Aug 2008 21:42:01 +0000 (UTC)
Organization: L &#38; D Engineering LLC
Lines: 46
Message-ID: <g8cqb9$6mk$1@fred.mathworks.com>
References: <g7o91i$add$1@fred.mathworks.com>
Reply-To: "Donn Shull" <donn.shull.no_spam@aetoolbox.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1219095721 6868 172.30.248.37 (18 Aug 2008 21:42:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 18 Aug 2008 21:42:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 219306
Xref: news.mathworks.com comp.soft-sys.matlab:486125



"Hemin " <hemin.essa@ymail.com> wrote in message 
<g7o91i$add$1@fred.mathworks.com>...
> I have cell array like that , for example multiple rows 6 
> rows with one column:
> {[1,2]
> [1,2,3]
> [1,2,3,4]
> [1,2,3,4,5]
> [1,2,3,4,5,6]}
> 
> so how I can make an array that calculate size of each 
row.
> for example the second row is 3, third row is 4 and 4th 
row 
> is 5 elements.
> does any function that can make the length or the size of 
> each row of that cell array?

use cellfun

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

a = 

    [1x2 double]
    [1x3 double]
    [1x4 double]
    [1x5 double]
    [1x6 double]


>> b = cellfun('length', a)

b =

     2
     3
     4
     5
     6