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
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
Excel version 15.34. I used xlsread. MATLAB_R2016a
Walter Roberson
Walter Roberson 2018 年 6 月 15 日
Sounds like a corrupted file to me, but you could try using readtable() with it.
Guillaume
Guillaume 2018 年 6 月 15 日
Does the file open fine in excel? Can you attach it to your question by any chance?
it is originally a .csv file. I saved it in .xls as it is more familiar to me. I am attaching both files.
Guillaume
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
Walter Roberson 2018 年 6 月 15 日
I suggest using readtable() of the .xls, possibly using the 'sheet' option since you have two sheets.
I am not clear what either Guillaume and Walter say how to proceed with csv or readtable.
Walter Roberson
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 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by