why reading .xls file using xlsread returns empty variables?

4 views (last 30 days)
Hello
I have some data in a .xls file. the file content is four colunms. the first row is a header then all others are numbers.
I tried to simply use
[ndata, text, alldata] = xlsread(filename)
but it does not return anything
ndata =
[]
text =
0×0 empty cell array
alldata =
1×1 cell array
{[NaN]}
How can I solve this problem?
Thanks!
  4 Comments
Nora Khaled
Nora Khaled on 20 Nov 2020
Thank you!
your comment made me realize the problem.
The problem is the data is not in the first sheet of the .xls file.

Sign in to comment.

Accepted Answer

Nora Khaled
Nora Khaled on 20 Nov 2020
The problem is the data is not in the first sheet of the .xls file.
I needed to sort the xls sheets before using
[ndata, text, alldata] = xlsread(filename)
  3 Comments
Peter Perkins
Peter Perkins on 20 Nov 2020
Also, KSSV's recommendation to use readtable instead of xlsread is still worth heeding.
Mathieu NOE
Mathieu NOE on 20 Nov 2020
yes sure
it's because I'm older and I'm always using "old" functions , but I'm improving lately on new stuff

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!