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 comentarios

Guillaume
Guillaume el 15 de Jun. de 2018
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 el 15 de Jun. de 2018
Sounds like a corrupted file to me, but you could try using readtable() with it.
Guillaume
Guillaume el 15 de Jun. de 2018
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 el 15 de Jun. de 2018
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 el 15 de Jun. de 2018
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 el 15 de Jun. de 2018
T1 = readtable('fire_archive_M6_12734_T.xls', 'Sheet', 1);
T2 = readtable('fire_archive_M6_12734_T.xls', 'Sheet', 2);

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by