How do I convert a string into a plotable time format?

I have an array called time that is storing time stamps as strings read in from an excel file:
time =
'4/3/2017 12:30:17 PM'
'4/3/2017 12:30:17 PM'
'4/3/2017 12:30:18 PM'
...
How do I convert these values into numerical times that I can then use to plot data?

回答 (2 件)

Star Strider
Star Strider 2017 年 5 月 4 日

0 投票

Try this:
time = ['4/3/2017 12:30:17 PM'
'4/3/2017 12:30:17 PM'
'4/3/2017 12:30:18 PM'];
dnv = datenum(time); % Date Number Vector
check = datevec(dnv); % Check Conversion (Delete)

カテゴリ

ヘルプ センター および File ExchangeDates and Time についてさらに検索

質問済み:

2017 年 5 月 4 日

編集済み:

2017 年 5 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by