Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Picking Ones among Zeros
Date: Sat, 4 Jul 2009 22:25:02 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 6
Message-ID: <h2okru$frv$1@fred.mathworks.com>
References: <h2oif2$g5h$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1246746302 16255 172.30.248.37 (4 Jul 2009 22:25:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 4 Jul 2009 22:25:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com comp.soft-sys.matlab:552823


If you don't have bwlabel, this should work:

D = diff(findstr(a,1));
diff([0 find(D~=1) length(D)+1])

caveat: I didn't test this out on MATLAB, this PC doesn't have it.  I think this will work though!