Path: news.mathworks.com!not-for-mail
From: "ade77 " <ade100a@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: applying functions to grouped data
Date: Wed, 4 Nov 2009 23:25:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <hct2gg$mm8$1@fred.mathworks.com>
References: <hcsqn1$ju4$1@fred.mathworks.com>
Reply-To: "ade77 " <ade100a@gmail.com>
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 1257377104 23240 172.30.248.35 (4 Nov 2009 23:25:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 23:25:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1059495
Xref: news.mathworks.com comp.soft-sys.matlab:582560


you can use a moving average filter. Type doc filter.

Also, if you can include the year with your date, then it will be more appropriate, and you can change it to a date number.

Let me know if you need more help with the code.

> Date  Height Weight
> 1/31      30     20
> 1/31      23     43
> 1/31      20     50
> 2/28      10     40
> 2/28      40     30
> 3/31      90     40
> 3/31      10     30
> 3/31      40     60
> 
> i want to compute 2-month rolling averages of height and weight.  so on 2/28, i want the averages of heights on 1/31 and 2/28, and averages of weights on 1/31 and 2/28.  For 3/31, i want to do the same for 3/31 and 2/28.  I will end up with something like this:
> 
> Date  Rolling2-monthHeight   Rolling2-monthWeight
> 2/28       24.6                            36.6
> 3/31       38                               40


you can use a moving average filter. Type doc filter.

Also, if you can include the year with your date, then it will be more appropriate, and you can change it to a date number.

Let me know if you need more help with the code.