Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Data Bin
Date: Thu, 8 Oct 2009 18:45:19 +0000 (UTC)
Organization: PatientsLikeMe
Lines: 20
Message-ID: <halbvv$b1p$1@fred.mathworks.com>
References: <haag95$o14$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1255027519 11321 172.30.248.35 (8 Oct 2009 18:45:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 8 Oct 2009 18:45:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1841757
Xref: news.mathworks.com comp.soft-sys.matlab:576032


"AP Pal" <avispal@gmail.com> wrote in message <haag95$o14$1@fred.mathworks.com>...
> I am new to matlab and am stuck  with what seems simple task
> i have  a column of data 1000 pts long. i need to average in groups of 10 so i need to generate a new matrix which has 100pts.
> 

You want to use the "filter" command. The first example in "doc filter" discusses how to do a running average. This can be adapted to your case.

You should double-check this, because I did it under the influence of rum, but I believe that if "x" is your original array, then

>> y = filter((1/10)*ones(1,10),1,x);

will give the running average of ANY ten consecutive entries, and

>> z = y(10:10:end);

will then give you the averages of the particular groups of ten that you want (i.e. every tenth row of "y").

Hope that helps.

the cyclist