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

조회 수: 1 (최근 30일)
Tony Castillo
Tony Castillo 2020년 12월 18일
댓글: Tony Castillo 2020년 12월 18일
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