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$>
References: <gphqm6$eh5$> <gpif2l$rg2$> <gpjaju$pkq$> <gpjbht$l97$> <gpjlkd$j8e$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1237177804 21806 (16 Mar 2009 04:30:04 GMT)
NNTP-Posting-Date: Mon, 16 Mar 2009 04:30:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:525111

"R L" <> wrote in message <gpjlkd$j8e$>...
> 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