Reading dates/times from a text file
24 次查看(过去 30 天)
显示 更早的评论
I want to read all the dates and times from a text file into an array of serial date numbers.
I've always done this in the past with textread and then parsing the date string.
There seems to be a more elegant way to do this, using readtable, but I'm struggling to make it work.
The format of the lines in the text file is this:
20210824_UTC_06:47:41
How do I read these in, using readtable or some other way?
0 个评论
回答(1 个)
Star Strider
2021-8-24
That is not a straightforward as it would fitst appear.
Try this —
Time = '20210824_UTC_06:47:41'
DT = datetime(Time, 'InputFormat','yyyyMMdd''_UTC_''HH:mm:ss', 'TimeZone','UTC')
DT.TimeZone = '-7' % Convert To: UTC-7:00:00
.
2 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!