Mean of elements of array
Mostrar comentarios más antiguos
Hi,
I have an array of length 8000. I want to create another array by taking the mean of 10 elements at a time. I could do this using for loop. However, using for loop is time consuming and would like to know if there is any alternative for this.
Any help is highly appreciated.
array = rand(1,8000);
mean_array = zeros(1,800);
for i=1:800
mean_array(1,i) = mean(array(1,((i-1)*10+1):i*10));
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!