Rounding UTC times down help
Mostra commenti meno recenti
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 Commenti
dpb
il 13 Giu 2020
Use retime with desired duration vector...
Alistair Walker
il 13 Giu 2020
dpb
il 13 Giu 2020
>> 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
il 13 Giu 2020
dpb
il 13 Giu 2020
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.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Timetables in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!