Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Split a monotonic array
Date: Mon, 20 Oct 2008 12:29:01 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 20
Message-ID: <gdhtid$fb4$1@fred.mathworks.com>
References: <gdg54q$3e1$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.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 1224505741 15716 172.30.248.38 (20 Oct 2008 12:29:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 20 Oct 2008 12:29:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:496218

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gdg54q$3e1$1@fred.mathworks.com>...
> I have a strict sorted array such as
> 
> A = [ 8 17 24 29 33 36 39 45 56 64 ]
> 
> I would like to split this array into non-overlapping parts such that: in each part A is bracketed in a interval not larger than a given length said dmax=30.
> 
> So in the above I would have
> 
> A1 = [ 8 17 24 ]
> A2 = [ 29 29 33 36 39 45 ]
> A3 = [ 56 64 ]
> 
> I have tried free algorithms to split A

Are you willing to use histc to bin the elements?

[junk,bins] = histc(A,A(1):dmax:A(end));

John