From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matrix similar line sum
Date: Tue, 3 Feb 2009 00:10:03 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 11
Message-ID: <gm820r$qov$>
References: <gm7vmc$n1s$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1233619803 27423 (3 Feb 2009 00:10:03 GMT)
NNTP-Posting-Date: Tue, 3 Feb 2009 00:10:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: comp.soft-sys.matlab:515540

[t idxf] = unique(o(:,1:3),'rows','first');
[t idxl] = unique(o(:,1:3),'rows','last');
tmp = [0; cumsum(o(:,4))]
desired = [t(:,1:3), tmp(idxl+1)-tmp(idxf)]

Also, there have been several problems of this type in the last few weeks if you want to look for other discussions.