Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: average of sections of an array
Posted:
Oct 20, 2012 7:08 AM


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <k5tv44$8pf$1@newscl01ah.mathworks.com>... > "Daniel Robbins" <d.w.e.robbins@gmail.com> wrote in message <k5tthg$3nb$1@newscl01ah.mathworks.com>... > > Does anyone know how to calculate windows of means in a vector? > > > > For example If I have a = [9 9 9 6 6 6 3 3 3] and I want to calculate the means in groups of three I would get b = [9 6 3]? > > a = [9 9 9 6 6 6 3 3 3] > b = mean(reshape(a,3,[]),1) > > % Bruno
Works perfectly, thanks Bruno.



