reading a .xls file
古いコメントを表示
when i try to read a .xls file it gives the following error. I do not see any difference in line 251. Length of the file is just about 2000 rows and 13 columns.
Error using xlsread (line 251) XLSREAD unable to read sheet '2017'. File contains unexpected record length. Try saving as Excel 98.
9 件のコメント
Guillaume
2018 年 6 月 15 日
Which version of excel have you got installed? And which function are you using to read the file, xlsread or readtable? Finally, which version of matlab?
Sounds like your excel file is corrupted
Thishan Dharshana Karandana Gamalathge
2018 年 6 月 15 日
Walter Roberson
2018 年 6 月 15 日
Sounds like a corrupted file to me, but you could try using readtable() with it.
Guillaume
2018 年 6 月 15 日
Does the file open fine in excel? Can you attach it to your question by any chance?
Thishan Dharshana Karandana Gamalathge
2018 年 6 月 15 日
Guillaume
2018 年 6 月 15 日
I get no error when opening your file with xlsread. However, I'm using a newer version of excel and matlab (Office365 and R2018a respectively). I'm fairly certain the error you see comes from excel.
It's a rather puzzling error since it complains about a sheet called '2017' which does not exists in your workbook. Which exact command are you using?
Why don't read the csv file directly in matlab?
Walter Roberson
2018 年 6 月 15 日
I suggest using readtable() of the .xls, possibly using the 'sheet' option since you have two sheets.
Thishan Dharshana Karandana Gamalathge
2018 年 6 月 15 日
Walter Roberson
2018 年 6 月 15 日
T1 = readtable('fire_archive_M6_12734_T.xls', 'Sheet', 1);
T2 = readtable('fire_archive_M6_12734_T.xls', 'Sheet', 2);
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!