Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!11g2000prv.googlegroups.com!not-for-mail
From: TideMan <mulgor@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to average column values to the same minute?
Date: Wed, 2 Jun 2010 13:43:10 -0700 (PDT)
Organization: http://groups.google.com
Lines: 50
Message-ID: <83ae6706-488d-4f66-ba0a-56dff8392379@11g2000prv.googlegroups.com>
References: <hu6ca4$6p$1@fred.mathworks.com> <f97cec95-f9ec-41a2-840b-76de084de454@y18g2000prn.googlegroups.com> 
	<hu6elm$9ti$1@fred.mathworks.com>
NNTP-Posting-Host: 202.78.152.105
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1275511390 5930 127.0.0.1 (2 Jun 2010 20:43:10 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 2 Jun 2010 20:43:10 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: 11g2000prv.googlegroups.com; posting-host=202.78.152.105; 
	posting-account=qPexFwkAAABOl8VUndE6Jm-9Z5z_fSpR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) 
	Gecko/20100401 Firefox/3.6.3,gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:641607

On Jun 3, 8:24 am, "Li " <liqingji...@gmail.com> wrote:
> Thank you for the reply.
>
> Sorry for the confusion. The data is at 5-second interval. So I want to average them into the same minute.
>
> I did not mean ismember will work here at all, I was trying to find out if there a function similar to ismember that could solve my problem. Please ignore this.
>
> TideMan <mul...@gmail.com> wrote in message <f97cec95-f9ec-41a2-840b-76de084de...@y18g2000prn.googlegroups.com>...
> > On Jun 3, 7:44 am, "Li " <liqingji...@gmail.com> wrote:
> > > I have a large matrix like below:
>
> > > year month day hour min sec A_value
> > > 2010 5 20 9 30 05 396
> > > 2010 5 20 9 30 10 470
> > > 2010 5 20 9 30 15 490
> > > ...
> > > ...
>
> > > I want to calculate the average A_value (the last column) withini a minute. Other than getting a loop and finding all rows with the same year month day hour minute and average them, is there a quicker way to do this? I know 'ismember' works for column data, do we have something like that?
>
> > > Thanks.
>
> > > Instead of
>
> > What does this mean: "average A_value (the last column) withini a
> > minute"?
> > The data appear to be at 5 min intervals.
> > How can you average within a minute when the data are spaced at 5 min
> > intervals?
> > Does it mean you want to interpolate every minute?
> > Does it mean you want to interpolate every 5 minutes?
>
> > I have no idea why you think you could use ismember for this task.
> > Please explain.

Oh, I see.........
I misread the headers.

A1=reshape(A(:,6),12,[]);  % Form a 12xn matrix
Abar=mean(A1).';   % Take the mean of each column and transpose

Note: the no of rows in the matrix A must be a multiple of 12 or you
must reduce it to that.