Info
此问题已关闭。 请重新打开它进行编辑或回答。
I have a text file contain the date and time like this 20180405125901 (2018-April-05 12:59:01), can matlab load the file and convert it to datetime like this 05-Apr-2018 12:59:01
1 次查看(过去 30 天)
显示 更早的评论
I have a text file contain the date and time like this 20180405125901 (2018-April-05 12:59:01), can matlab load the file and convert it to datetime like this 05-Apr-2018 12:59:01
0 个评论
回答(2 个)
Elias Gule
2018-4-5
try this:
str = '20180405125901';
t = datetime(str,'InputFormat','yyyyMMddhhmmss')
1 个评论
Peter Perkins
2018-4-6
If this is a CSV or similar, it's also possible to use readtable and read them in directly as datetimes. Specify the datetime format as Elias suggests. Depending on what version of MATLAB you have, detectimportoptions might also be useful.
1 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!