Average of 5 locations for each time
1 次查看(过去 30 天)
显示 更早的评论
%Point Barrow, Alaska
PB=readtable('monthly_flask_co2_ptb.csv');
%create time and CO2 variable
%time
PBdailyt=PB(:,4);
%CO2
PBdailyCO2=PB(:,7);
%take data out of table and put into array
PBt=table2array(PBdailyt);
PBCO2=table2array(PBdailyCO2);
%index to extract outliers
idx = PBCO2 >=500 | PBCO2 <=300 ;
%set outliers equal to NaN
PBCO2(idx) = NaN;
I have 5 different locations, above I have included one of them. I am trying to calcuate the average of all 5 locations to plot against time. My goal is to have the 5 locations combined and plotted against time, and then to extrapolate it.
2 个评论
回答(1 个)
Star Strider
2021-12-9
.
1 个评论
Star Strider
2021-12-9
Try this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/828030/monthly_flask_co2_ptb.csv', 'VariableNamingRule','preserve', 'HeaderLines',56)
DTV = table(datetime(T1{:,1},T1{:,2},ones(size(T1{:,1}))), 'VariableNames',{'Date'});
T2 = [DTV, T1(:,5:end)]
T2.('Site Monthly Mean') = mean(T2{:,2:end},2)
Please be specific about what the desired result is, if this is not the desired result.
.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Preprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!