Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Counting consecutive 1s in a matrix
Date: Tue, 1 Mar 2011 15:41:21 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 36
Message-ID: <ikj431$agj$1@fred.mathworks.com>
References: <ikj2pa$hj1$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1298994081 10771 172.30.248.45 (1 Mar 2011 15:41:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 1 Mar 2011 15:41:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:713199

Possibly this might help:
http://www.mathworks.com/matlabcentral/fileexchange/24255-consecutive-vector-spliter

V =[ 1 1 0
     1 1 0
     1 1 0
     1 2 0
     1 2 0
     1 3 0
     1 4 0
     2 1 0
     2 2 1
     2 3 1
     2 4 1
     2 5 1
     2 6 1
     2 6 1
     3 1 0
     3 2 1
     3 2 0
     3 3 0
     3 4 0
     3 4 0
     3 4 1
     3 4 1
     3 4 1
     3 4 1
     3 4 0
     3 4 0
     3 4 1 ]

% SplitVec from http://www.mathworks.com/matlabcentral/fileexchange/24255
[lgt row] = SplitVec(V,[],'length','firstelem');
max(lgt(row(:,3)==1))

% Bruno