I imported time from excel file using readtable and it seems that the variable time is in text form. My time in excel has this format: 20190101:1700 How can i convert this in to datetime datatype in matlab

 採用された回答

Star Strider
Star Strider 2020 年 6 月 23 日

0 投票

Assuming the date format and that the rows are character arrays, try this:
dtc = '20190101:1700';
dt = datetime(dtc, 'InputFormat','yyyyMMdd:HHmm')
producing:
dt =
datetime
01-Jan-2019 17:00:00
.

2 件のコメント

Sree Harsha Bandaru
Sree Harsha Bandaru 2020 年 6 月 24 日
Thank you very much. It worked
Star Strider
Star Strider 2020 年 6 月 24 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2019a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by