Error using .xlsread

8 次查看(过去 30 天)
Kareemulla Dudekula
回答: Yash 2024-1-2
EDIT: adding picture here
Dear All,
I am reading data into my MATLAB code throguh several .xls files; occassionally, I am running into the error, 'Error using xlsread'. Could someone please help me understand the source of this error and help fix it.
Thanks in advnace!
Regards,
  5 个评论
dpb
dpb 2023-11-1
Well, that's a painful way for respondents/volunteers here to have to try to search out what went wrong, @Kareemulla Dudekula. At a barest of minimums attach the text of the error (all the red text) in context with the code you ran that generated the error.
It's likely no real solution will be possible without the actual spreadsheet to test with; attach it instead of the one you did.
Then, @KSSV's comment is extremely pertinent, don't use deprecated xlsread but one of the modern suggested replacements; readtable would be another likely candidate.
Kareemulla Dudekula
Thank you very much for the suggestions; I shall implement and see if the this persistan problem can be fixed.
Regards,

请先登录,再进行评论。

回答(1 个)

Yash
Yash 2024-1-2
Hi Kareemulla,
I understand you are facing issues while using the "xlsread" function. As per the MATLAB documentation, "xlsread" is deprecated and is not recommended. You should use "readtable", "readmatrix", or "readcell" instead.
If, due to some reasons, you need to use "xlsread" function only, then consider the following points:
The error that you are facing is caused by excel, whis might be due to a variety of reasons. It is not possible to determine the exact reason without the actual spreadsheet. You can try these troubleshooting steps:
  • Restart MATLAB: This works in most of the cases. The problem often resolves after a fresh restart.
  • Check File Name Length: The character limit on the length of a filename in Excel (folder + base file name) is limited to 218 characters. ensure that it is shorter than that.
  • Protected Mode in Excel: If the file is opened in the protected mode, make sure you enable editing and disable the protected mode.
  • Network directory: If the file is present in a network(shared) folder, there might be a chance that many users are accessing the same file simultaneously. Try to copy that on your local disk and run again.
You can also seek help from the following MATLAB Answer:
I hope these suggestions help you address your query.

标签

Community Treasure Hunt

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

Start Hunting!

Translated by