Computing the mean over 3 numbers in a matrix
이전 댓글 표시
I have a matrix with dimensions of 5000*51. I want to find the average over each 3 numbers and finally I have a matrix of 5000 * 17.
댓글 수: 1
Image Analyst
2021년 6월 6일
Do you want a moving mean where the window of 3 moves over one row, or one column, each time, or do you want the window to move in jumps of 3? Do you want 3 in the same row to be averaged? Or do you want the 3 to be in the same column? Which way do you want the mean to go????
채택된 답변
추가 답변 (1개)
Chunru
2021년 6월 6일
A = rand(5000, 51); % your data
A1 = reshape(A, [5000 3 17]); % reshape the 51 element by 3x17 array
meanA = mean(A, 2); % Mean along 2nd dimension
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!