How can I take a mean of a matrix only from 10 first rows?

6 vues (au cours des 30 derniers jours)
Marianne Auvinen
Marianne Auvinen le 17 Sep 2019
I have a 50000x3 matrix X and I would need to take column means taking only first 5000 rows into account.
mean_values = mean(X(1:5000, :)) only gives one mean value instead of giving mean values for each 3 columns.
What should I do?
  3 commentaires
James Tursa
James Tursa le 17 Sep 2019
Did you inadvertently shadow the mean( ) function?
Marianne Auvinen
Marianne Auvinen le 17 Sep 2019
I'm using R2018b

Connectez-vous pour commenter.

Réponses (1)

madhan ravi
madhan ravi le 17 Sep 2019
>> X = rand(50000,3); % are you sure it's a 50000 by 3 matrix?
>> mean(X(1:5000,:))
ans =
0.5028 0.5015 0.4978
>>
  1 commentaire
Marianne Auvinen
Marianne Auvinen le 18 Sep 2019
Thanks I found the problem. It wasn't 50000x3 after all

Connectez-vous pour commenter.

Catégories

En savoir plus sur NaNs 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