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!