MATLAB: How can i make xlsread read successive excel worksheets

loopsize of matrixxlsread

I have a problem reading data from successive excel worksheets within a loop… The size of data in successive sheets are different, when I type the size of stored matrix … it always shows the size of data in first worksheet … why ?

Best Answer

Use
fileName = 'myExample.xlsx'
[status,sheets,xlFormat] = xlsfinfo(fileName )
to get the sheet names, then use xlsread() to open them
for k = 1 : length(sheets)
data = xlsread(fileName, sheets{k});
% Now do something with data....
end