Path: news.mathworks.com!not-for-mail
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$1@fred.mathworks.com>
References: <gm7vmc$n1s$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1233619803 27423 172.30.248.38 (3 Feb 2009 00:10:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 3 Feb 2009 00:10:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com 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.




[dWGcmm[OOmmtmmVmg.OS{SPOQVU](Y]\bm;Z\Z]b]ObO]QWSSVOt]3P^^c