Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Finding end-points for runs
Date: Sun, 27 Jan 2013 08:27:06 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 7
Message-ID: <ke2ocq$7ve$1@newscl01ah.mathworks.com>
References: <cd7ccb2d-8c83-4568-a565-22f22a9416bf@googlegroups.com> <ke2h4c$dju$1@newscl01ah.mathworks.com> <ke2nq4$62a$1@newscl01ah.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1359275226 8174 172.30.248.38 (27 Jan 2013 08:27:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 27 Jan 2013 08:27:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:787474

Just to make it shorter

b = [true diff(Y)>1]
Z = [Y(b)-1;  Y([b(2:end) true])+1];
Z = Z(:,cumsum(b))'

% Bruno