Add time to a datetime array
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Arthur Leon
am 9 Mär. 2021
Beantwortet: Cris LaPierre
am 9 Mär. 2021
I have to select the hourly value of relative air saturation and temperature at 14:05 a clock.
From an datetime array containing the 10 minutes values of all dates i created an daily datetime array using:
dt = table2array(T(:,3 ));
dt = datetime(dt, 'InputFormat', 'dd-mmm-yyyy HH-MM-SS');
dt_daily = dt(1:144:end);
how can i add to each dt_daily 14 hours so that i have an index to extract the respective values from the table?
Thanks a lot for your help!
Best regards,
Arthur
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 9 Mär. 2021
I would use the datetime values you already have in your table T.
load T_matlab.mat
ind = timeofday(T.DateTime) == duration(14,05,0);
dayT = T(ind,["DateTime","H_air___","T_air_C_"])
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!