Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
BingoIngo
BingoIngo le 9 Mai 2019
Commenté : dpb le 9 Mai 2019
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 commentaire
dpb
dpb le 9 Mai 2019
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

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by