Reading dates/times into MATLAB and saving as a numeric vector
Afficher commentaires plus anciens
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)?
Réponse acceptée
Plus de réponses (1)
Fangjun Jiang
le 5 Jan 2018
Modifié(e) : Fangjun Jiang
le 5 Jan 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
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!