How to read time as string data from excel file
15 ビュー (過去 30 日間)
古いコメントを表示
Yasuyuki Hamanaka
2021 年 5 月 24 日
コメント済み: Yasuyuki Hamanaka
2021 年 5 月 24 日
I used readtable to read time from excel spread sheets. The time was converted to double like e.x. But I want to read time as original form. How does read time as string?
e.x 10:11:09 AM => 0.42858
0 件のコメント
採用された回答
Yutaka Yamada
2021 年 5 月 24 日
How about the below code if you want to use readtable?
opts = detectImportOptions('readTime.xlsx');
opts.VariableTypes = 'datetime';
T = readtable('readTime.xlsx', opts);
for i = 1:3
a = T{i, 1};
a.Format = 'HH:mm:ss a';
end
I've attached the Excel file that I've used for this test also.
3 件のコメント
その他の回答 (1 件)
Sulaymon Eshkabilov
2021 年 5 月 24 日
Hi,
You should try using xlsread() in this case. In fact, xlsread is slower than readtable().
Then you can employ datenum() and datestr() if necessary.
Good luck.
参考
カテゴリ
Help Center および File Exchange で Calendar についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!