Add time to a datetime array
17 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Cris LaPierre
on 9 Mar 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 Comments
More Answers (0)
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!