Reading dates/times into MATLAB and saving as a numeric vector
Mostrar comentarios más antiguos
I am reading in *.txt files that contain a column of dates (i.e. 17.11.2017 09:57:24.06). Each row is a signal at a frequency of 0.01 seconds. I want to be able to bring this in as a numeric vector so that I can determined time elapsed between selected rows. Using x = datenum(filename) gives me 736696.4149 (number of days from Jan 0, 0000) for both 17.11.2017 09:57:24.06 and 17.11.2017 09:57:29.96. These are 5.90 seconds apart. How do I read these dates/times in so that I can maintain the precision I need to maintain (0.01 seconds)?
Respuesta aceptada
Más respuestas (1)
Fangjun Jiang
el 5 de En. de 2018
Editada: Fangjun Jiang
el 5 de En. de 2018
Don't worry. The precision is kept.
a=datenum('17.11.2017 09:57:29.96');
b=datenum('17.11.2017 09:57:24.06');
datestr(a-b,'HH:MM:SS.FFF')
datevec(a-b)
second(a-b)
ans =
'00:00:05.900'
ans =
0 0 0 0 0 5.9000
ans =
5.9000
Categorías
Más información sobre Dates and Time en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!