Converting time to usable format
Mostrar comentarios más antiguos
After calling a data source (CSV or xlsx) I need to be able to utilize the time column which was currently depicted utilizing the following format: 319:17:19:21.28 (Day, Hrs, Min, Sec, mS). How can I convert this to a usable time stamp?
2 comentarios
Elias Gule
el 5 de Abr. de 2018
By time stamp, a time vector containing time values in specific units: 319:17:19:21.28 converted to 319*24*60*60 + 17*60*60 + 19*60 + 21 + 28/1000 seconds
Phil Sibley
el 5 de Abr. de 2018
Respuestas (1)
Peter Perkins
el 6 de Abr. de 2018
Is this what you are looking for?
>> datetime('319:17:19:21.28','InputFormat','DDD:HH:mm:ss.SS','Format','dd-MMM-yyyy HH:mm:ss.SSS')
ans =
datetime
15-Nov-2018 17:19:21.280
There's no year in your timestamp, so datetime assume "this year". Or maybe you want an elapsed time, not a datetime. Beginning in R2018a, you can do this:
>> duration('319:17:19:21.28','Format','dd:hh:mm:ss.SS')
ans =
duration
319:17:19:21.28
The load function loads a mat file, so I'm not following how anything could be cut off. You're going to have to say more about how you are importing the data. For a CSV of XLS[X], best bet is likely readtable.
Categorías
Más información sobre Data Type Conversion 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!