Path: news.mathworks.com!not-for-mail
From: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Consecutive Numbers !
Date: Fri, 21 Dec 2007 01:40:00 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <fkf5hg$jta$1@fred.mathworks.com>
References: <fkf1sr$a05$1@fred.mathworks.com>
Reply-To: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
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 1198201200 20394 172.30.248.37 (21 Dec 2007 01:40:00 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 21 Dec 2007 01:40:00 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:443253


"alan dinno" <alan_dinno@hotmail.com> wrote in message <fkf1sr$a05
$1@fred.mathworks.com>...
> Hi -
> 
> If V is a col vector, I want H to be the number of highest 
> consecutive sequential count in V.
> 
> Example: If V=[22; 23; 24; 40; 44; 50; 51; 52; 53]
> Then, since the highest consecutive count comes from 
> numbers 50,51,52 and 53,it means H=4.
> 
> Another example:
>  If V=[6; 9; 14; 15; 16; 50; 58; 52; 53], then since the 
> highest consecutive count comes from 14,15,16, it means 
> H=3.
> 
> Thanks
> al
-------
Try this:

 H = max(diff(find([1,diff(V)~=1,1])));

Roger Stafford