How do I read a text file and convert the dates and time?

8 ビュー (過去 30 日間)
Sonima
Sonima 2018 年 7 月 25 日
編集済み: Sonima 2019 年 8 月 15 日
Hi! I have a text file that includes the following:
2015-06-18 12:00

採用された回答

jonas
jonas 2018 年 7 月 25 日
編集済み: jonas 2018 年 7 月 25 日
Your format string is wrong, try
datenum(tt,'yyyy-mm-dd HH:MM');
better yet, use datetime

その他の回答 (1 件)

Peter Perkins
Peter Perkins 2018 年 8 月 3 日
It's likely that you want to read the file using readtable, and if you are using a recent version of MATLAB, you will get datetimes automatically. If not, you can convert to datetime after importing.
You are better off using datetime than datenum.

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by