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!