Converting time to usable format
이전 댓글 표시
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
Elias Gule
2018년 4월 5일
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
2018년 4월 5일
답변 (1개)
Peter Perkins
2018년 4월 6일
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.
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!