Mean of some element in Array

조회 수: 1 (최근 30일)
Rica
Rica 2012년 11월 2일
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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 2일
편집: Azzi Abdelmalek 2012년 11월 2일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by