Mean of some element in Array

Hi! I have a array of size 8501*1. iwa nt to have the mean value of each 10 element. Afte each 10 elebent make a mean value. How to do this in matlab withot for-loop
Thanks

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 2 de Nov. de 2012
Editada: Azzi Abdelmalek el 2 de Nov. de 2012

1 voto

A=rand(8501,1); %your data
B=mean(reshape(A(1:8500),10,[]))
with the for loop
ii=1;
A=rand(8501,1)
for k=1:10:8501-10
out(ii)=mean(A(k:k+9));
ii=ii+1
end

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 2 de Nov. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by