Mean of elements of array
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!