Rounding UTC times down help
이전 댓글 표시
Hi, I'm trying to round times down to 10 mins at intervals 5, 15, 25, 35, 45, 55 mins. The format i'm using is yyyy-mm-dd hh:mm:ss in a table.
I have tried:
data_lables.UTC = datetime(data_lables.UTC);
vec = datevec(data_lables.UTC);
v5 = vec(:,5)+vec(:,6)/60;
vec(:,5) = round(v5/10)*10;
vec(:,6) = 0;
data_lables.UTC = datetime( vec );
but this rounds to 00, 10, 20 ,30 ,40 ect.
댓글 수: 5
dpb
2020년 6월 13일
Use retime with desired duration vector...
Alistair Walker
2020년 6월 13일
dpb
2020년 6월 13일
>> minutes(5:10:100)
ans =
1×10 duration array
5 min 15 min 25 min 35 min 45 min 55 min 65 min 75 min 85 min 95 min
>>
Alistair Walker
2020년 6월 13일
dpb
2020년 6월 13일
The input to use retime has to be a timetable, true...
Alternatives would be far easier to try to write if saw what the data are and knew what you're trying to do with other data -- interpolate, bin, or just reset the time vector. If it's just the latter and they're even, roughly, then just writing the desired timestamp might be the simplest.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Timetables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!