필터 지우기
필터 지우기

How to calculate mean value of a column in a table only for certain rows?

조회 수: 1 (최근 30일)
BingoIngo
BingoIngo 2019년 5월 9일
댓글: dpb 2019년 5월 9일
Hello,
I have a table with a lot of rows. In order to determine the mean value of these rows over time, I want to split the table in about 10 parts (1st part would be from 1 to 500k, 2nd part from 500001 to 1000k, etc.). Does anyone know a smart, fast syntax for solving this problem?
(For determining the mean value of the whole column I am currently using meanColumn = mean(MyTable.Column, 'omitnan')).
Many thanks in advance!!
  댓글 수: 1
dpb
dpb 2019년 5월 9일
If it is simply into (roughly) equal parts, just computing a set of indices and looping over them is probably as simple a solution as is...
If the number of rows is precisely divisible by the number of desired groups, there's the "trick" of reshape() to that number of columns and then use mean over the array which computes the means by column.
If there's some other variable by which to group, there's always findgroups and splitapply

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by