How to convert decimal hour and calculate the average every 5 min?
이전 댓글 표시
Hello all! I'm a beginner at Matlab and I need to solve a problem. First, I need to convert the UT columm from decimal hour to hour:minute:seconds. Then, I need to calculate every 5 minutes on average the ROT collumn and show the reply in a new matrix (hour:min:sec,rot mean).
Example:

e.g. UT (5.404)=0.404*60=24.252; 0.252*60=15.12 ,then UT(5.404)=5:24:15 hours:min:sec
Thanks in advance
Marcelo
댓글 수: 2
Doug Hull
2013년 11월 15일
Why are you dropping the 0.004 in the first step?
>> [Y, M, D, H, MN, S] = datevec(5.404/24)
Y =
0
M =
0
D =
0
H =
5
MN =
24
S =
14.4000
Marcelo Duarte
2013년 11월 16일
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2013년 11월 17일
k = rem(UT,1)*60;
tms = fix([UT,k]);
m = ceil(k/5)*5;
[~,b,ii] = unique(m);
out = [tms(b,:), accumarray(ii,ROT,[],@mean)];
카테고리
도움말 센터 및 File Exchange에서 Time Series Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!