フィルターのクリア

Numeric array to serial datetime

2 ビュー (過去 30 日間)
Annika
Annika 2022 年 9 月 29 日
回答済み: Star Strider 2022 年 9 月 29 日
I have a date and time in two columns, where date is datetime and time is a string. I want to convert these to serial datetime and further combine them, after importing I changed the table to arrays:
DA = table2array(Feed(1,1))
TA = table2array(Feed(1,2))
then the time from string to number:
t = str2num(TA)
then the date to serial datetime:
sdt = datenum(DA)
How can I convert the time (number array) into serial datetime? (In excel its typed as ex. 14.45 (only hour + minutes)
(I know how to combine them)

採用された回答

Star Strider
Star Strider 2022 年 9 月 29 日
Perhaps something like this —
Feed{:,1} = datetime('29-Sep-2022');
Feed{:,2} = '14.45';
DT = Feed{:,1} + timeofday(datetime(Feed{:,2},'InputFormat','HH.mm'))
DT = datetime
29-Sep-2022 14:45:00
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by