Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to average one of column and then duplicate each row to next row?
Date: Thu, 5 Feb 2009 19:07:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <gmfdcl$sda$1@fred.mathworks.com>
References: <gmf1pe$jtm$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 1233860822 29098 172.30.248.38 (5 Feb 2009 19:07:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 5 Feb 2009 19:07:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:516422

"Kuo-Hsien" <mchangks@hotmail.com> wrote in message <gmf1pe$jtm$1@fred.mathworks.com>...
> .......
> Please advice me some easier method to rearrange this question I'm trying to solve.
> .......

  On the basis of what I see in your example, it has nothing to do with an "average".  You seem to be duplicating each row and dividing the fifth column by two.

  Call x the original data.

 [m,n] = size(x);
 x(:,n) = x(:,n)/2;
 x = reshape(repmat(x(:),1,2).',[],n);

Roger Stafford