Why the function mean does not return only one plot rather than 31?

1 vue (au cours des 30 derniers jours)
Tony Castillo
Tony Castillo le 18 Déc 2020
Commenté : Tony Castillo le 18 Déc 2020
Dear Coders,
I have an issue I am trying to obtain only one profile per month, so I want to make a day-average per month, but when I apply the function "mean" it does not calculate the row by row average, it gives me back the same 31 days, please, tell me what it is wrong in this simple operation. I share the code below.
clear all
close all
REE=xlsread('REE_perfiles2020.xlsx',1,'a3:h8786');
NDias=REE(:,1); %%%%%Número de días en total
aP=REE(:,4); %
ai=reshape(aP,[24, 366]);
E=ai(:,[1:31]);
ME=mean(E,24);
plot(ME)
legend
size(ME)

Réponse acceptée

Jan
Jan le 18 Déc 2020
mean(E, 24) calculates the mean over the 24th dimension. Remember that in Matlab all arrays are assume to have and arbitrary number of trailing dimensions of the size 1:
x = [2, 3; 4, 5]
x(1,2, 1,1,1,1,1,1,1,1,1,1,1,1,1,1) % Valid!
You want to bild the mean over the 2nd dimension, if I understand you correctly. Then:
mean(E, 2)

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by