- You want to use a "moving window" to average rows 1-to-10, 2-to-11, 3-to-12, etc.
- You want to segement rows in groups of 10 by averagine 1-to-10, 11-to-20, 21-to-30, etc.
- You want to average every 10th row meaning rows 10, 20, 30, 40, 50, etc. starting with row 10 which will result in one scalar value that is the average of those rows.
calculation of a mean
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, i have a column with 26668626 rows and 1 column which i will load from an excel file. after i loaded the data wanne have avrage av every 10th row to the end.i wish to put to the new colum.
tried with differet code but the result was not right.
Can someone sopported ?
Thanks Shayan
댓글 수: 3
답변 (3개)
dpb
2018년 11월 13일
26668626 isn't evenly divisible by 10; what do you want to do with the leftover 6 elements? You also can't add a column of 1/10th the length of the rest of the array onto the existing array.
Ignoring those last six,
mnx=reshape(mean(reshape(x(1:fix(length(x)/10)),10,[]),1,[]);
will return a column vector of means of each 10 successive elements, ignoring the last six.
Can append mean of those last onto the end or augment the original array to next multiple of 10 with NaN and use nanmean() instead on the resulting array of 26668630 elements.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!