dff = [0;diff(data(:,1))];
tm = cumsum(dff);
t = 1/60;
i_1 = floor(tm/t)+1;
[Mly,~,i1] = unique(i_1);
out1 = [Mly,accumarray(i1,data(:,2),[],@mean)];
[~,~,~,~,M] = datevec(tm/24);
[Mly,~,i2] = unique(M);
out2 = [Mly,accumarray(i2,data(:,2),[],@mean)];
dms = degrees2dms(tm);
[Mly,~,i3] = unique(dms(:,2));
out3 = [Mly,accumarray(i3,data(:,2),[],@mean)];
function dms = degrees2dms(angleInDegrees)
a = angleInDegrees(:);
m = rem(a,1)*60;
t = abs(m - round(m)) < eps(10e2);
m(t) = round(m(t));
dms = [fix(a),fix(m),round(60000*rem(m,1))/1000];
Time = hours(tm);
Temp = data(:,2);
T2 = timetable(Time,Temp);
out4 = retime(T2,'minutely','mean');
1 Comment
KSSV (view profile)
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/303871-mean-value-with-time-blanks#comment_392550
Sign in to comment.