Average of 5 locations for each time
2 views (last 30 days)
Show older comments
%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 Comments
Answers (1)
Star Strider
on 9 Dec 2021
.
1 Comment
Star Strider
on 9 Dec 2021
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.
.
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!