Reading data from Microsoft Excel
3 次查看(过去 30 天)
显示 更早的评论
What is the syntax for reading data from Microsoft Excel sheets? I tried the following and it returned error messages.
A = xlsread('amat.xlsx','sheet1','a1:a10')
I even changed the case of S in sheet to capital and the error persisted. Anyone with an idea?
采纳的回答
Cris LaPierre
2024-8-19
编辑:Cris LaPierre
2024-8-20
Note that xlsread is not recommended. Assuming you are just importing a matrix of numbers, I would use readmatrix.
A = readmatrix('amat.xlsx','Sheet','sheet1','Range','a1:a10')
0 个评论
更多回答(1 个)
Jatin
2024-8-20
There can be few reasons for getting errors while using the “xlsread” function.
Kindly follow these troubleshooting steps to make sure the function work correctly:
- Make sure the file is in the current directory or provide the full path to the file.
- Use the correct worksheet name and check for spelling and case sensitivity.
- Ensure that the range is specified properly, incorrect range may throw errors.
From R2019a, “xlsread” is not recommended as stated in the official documentation. You can switch to using “readtable”, “readmatrix” and “readcell” instead.
You can refer to the following MathWorks documentations for more information:
2 个评论
Cris LaPierre
2024-9-5
编辑:Cris LaPierre
2024-9-6
Consider attaching your file to your post using the paperclip icon. Please share the full error message (all the red text)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!