I have an array of 1000 elements I need to do average of 100 elements so that my new array is of 10 elements...
조회 수: 4 (최근 30일)
이전 댓글 표시
I have an array of 1000 elements I need to do average of 100 elements so that my new array is of 10 elements...
댓글 수: 0
답변 (1개)
Guillaume
2017년 3월 21일
reshape your array into 100 rows, take the mean across these 100 rows:
assert(mod(numel(yourarray), 100) == 0, 'number of elements is not a multiple of 100')
mean(reshape(yourarray, 100, []))
댓글 수: 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!