array of mean from array
조회 수: 1 (최근 30일)
이전 댓글 표시
hi
I have a 400x400 array, and I need a new array for example a 10:10 in which the first value is the average of the first (0:40,0:40) values of the original array ... the 2:1 value is an average of the values from (41: 80,0:40) and so on until the las 10:10 values that will be the average (360:400,360:400)
I hope is clear
I can do one by one but i try to put this in a for
any sugestion please
댓글 수: 0
채택된 답변
Fangjun Jiang
2019년 10월 11일
a=rand(400);
b=mat2cell(a,40*ones(10,1),40*ones(1,10));
c=cellfun(@mean,b,'uni',false);
d=cellfun(@mean,c,'uni',false);
e=cell2mat(d)
댓글 수: 0
추가 답변 (1개)
KALYAN ACHARJYA
2019년 10월 11일
편집: KALYAN ACHARJYA
2019년 10월 11일
One line with blockproc
data=magic(400);
result_mean=blockproc(data, [40 40], @(x) mean(x.data(:)));
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!