Averaging over certain elements in an array ?
이전 댓글 표시
Hi, I have the following array :
a=[1,1,1;1,2,1;1,3,1;1,7,1;1,8,1;2,4,2;4,5,2;4,6,2;3,3,3;4,5,3;5,6,4;];
rn = unique(a(:,3));
I would like to average all the a(:,1) & a(:,2) such that a(:,3) belongs to elements of rn, and store it another array, say C. For example, in this case, I would like to average C(1,1)=mean(a(1:5,1)), C(1,2)=mean(a(1:5,2)) , C(2,1)=mean(a(6:8,1)), C(2,2)=mean(a(6:8,2)) ... and so on
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Language Fundamentals에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!