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

9 Ansichten (letzte 30 Tage)
Marianne Auvinen
Marianne Auvinen am 17 Sep. 2019
Kommentiert: Marianne Auvinen am 18 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 Kommentare
James Tursa
James Tursa am 17 Sep. 2019
Did you inadvertently shadow the mean( ) function?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

madhan ravi
madhan ravi am 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
>>

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by