Add time to a datetime array
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Arthur Leon
el 9 de Mzo. de 2021
Respondida: Cris LaPierre
el 9 de Mzo. de 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 comentarios
Respuesta aceptada
Cris LaPierre
el 9 de Mzo. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!