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

1 次查看(过去 30 天)
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)

采纳的回答

Jan
Jan 2020-12-18
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by