Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matching data based on columns
Date: Mon, 16 Mar 2009 04:30:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 15
Message-ID: <gpkkkc$l9e$1@fred.mathworks.com>
References: <gphqm6$eh5$1@fred.mathworks.com> <gpif2l$rg2$1@fred.mathworks.com> <gpjaju$pkq$1@fred.mathworks.com> <gpjbht$l97$1@fred.mathworks.com> <gpjlkd$j8e$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 1237177804 21806 172.30.248.37 (16 Mar 2009 04:30:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 16 Mar 2009 04:30:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:525111

"R L" <rcwlhk@hotmail.com> wrote in message <gpjlkd$j8e$1@fred.mathworks.com>...
> Thank you very much Roger! I hope you'll have a great and safe trip. I look forward to hearing back from you! 
> R L

  Yes I returned safe but tired, R L.  As an octogenarian I guess I am getting a little old for this hiking stuff.

  Darren's solution to your alteration looks valid.  The other way to do it would be to create d just three columns wide and divide by it in the proper three column section of T.  The remaining two columns of T could simply be appended as they are.  I am referring to the T produced by 'accumarray' with sums in it, not the earlier T.

 ......
 d = repmat(diff(find([true;diff(n)~=0;true])),1,3);
 B = [B,T(;,1:3)./d,T(:,4:5)];

  I'll let you figure out the generalization in terms of p, q, and one more initially defined parameter: the width of the section to be simply added.

Roger Stafford