Read excel file with Matlab
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have excel file with three columns "Time", "Altitude, And "Shadow length" that I want to read in Matlab. I tried this commands below, however, the column "Time" format change to decimal number. What can I do to keep the time format the same?
Thank you!
T = readtable('Shadedata.xlsx');
opts = detectImportOptions('Shadedata.xlsx');
preview('Shadedata.xlsx',opts)
0 件のコメント
採用された回答
Star Strider
2023 年 8 月 18 日
One option is to use the datetime 'ConvertFrom' name-value pair. For the ‘value’ argument, both 'excel' and 'posixtime' work, with 'excel' appearing to be correct (in that it gives 15-minute intervals) —
% F = fileread('Shadedata.xlsx')
% C = readcell('Shadedata.xlsx')
T = readtable('Shadedata.xlsx', 'VAriableNamingRule','preserve')
T1 = T;
T1.Time = datetime(T1.Time, 'ConvertFrom','excel')
T2 = T;
T2.Time = datetime(T2.Time, 'ConvertFrom','posixtime')
Choose the result that makes the best sense.
.
6 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!