From: Ryan Morse on
I have velocity data with measurements made every 6 minutes for several months (uniform time). Each 6-minute interval is sampled with a burst of 10 samples, thus my data vector is 10x longer than my time vector (which is seperate from this matrix)

data <69590x18 double>
time <6959x12 double>

I need to average every 10 rows (for 1:length(data)) of the data matrix to get a final matrix size to 6959x18.

I am sure there is a really easy way to do this, but I cant seem to come up with it...

I thought this would work:

m=1:10:length(data);
avg= mean(data(m,:));

except that 'avg' is returned as a 1x18 matrix...

Any help is most appreciated.
From: Oleg Komarov on
"Ryan Morse" <remorse(a)odu.edu> wrote in message <hur7fg$6gp$1(a)fred.mathworks.com>...
> I have velocity data with measurements made every 6 minutes for several months (uniform time). Each 6-minute interval is sampled with a burst of 10 samples, thus my data vector is 10x longer than my time vector (which is seperate from this matrix)
>
> data <69590x18 double>
> time <6959x12 double>
>
> I need to average every 10 rows (for 1:length(data)) of the data matrix to get a final matrix size to 6959x18.
>
> I am sure there is a really easy way to do this, but I cant seem to come up with it...
>
> I thought this would work:
>
> m=1:10:length(data);
> avg= mean(data(m,:));
>
> except that 'avg' is returned as a 1x18 matrix...
>
> Any help is most appreciated.


avg = reshape(mean(reshape(data,10,[])),[],18);

Oleg
From: Ryan Morse on
"Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hur9h2$lv0$1(a)fred.mathworks.com>...
> "Ryan Morse" <remorse(a)odu.edu> wrote in message <hur7fg$6gp$1(a)fred.mathworks.com>...
> > I have velocity data with measurements made every 6 minutes for several months (uniform time). Each 6-minute interval is sampled with a burst of 10 samples, thus my data vector is 10x longer than my time vector (which is seperate from this matrix)
> >
> > data <69590x18 double>
> > time <6959x12 double>
> >
> > I need to average every 10 rows (for 1:length(data)) of the data matrix to get a final matrix size to 6959x18.
> >
> > I am sure there is a really easy way to do this, but I cant seem to come up with it...
> >
> > I thought this would work:
> >
> > m=1:10:length(data);
> > avg= mean(data(m,:));
> >
> > except that 'avg' is returned as a 1x18 matrix...
> >
> > Any help is most appreciated.
>
>
> avg = reshape(mean(reshape(data,10,[])),[],18);
>
> Oleg

Worked like a charm, thank you very much!