ursmooth
ursmooth

Reputation: 311

Xlsread sheet in for loop

I have a number of excel sheets I would like to cycle through enclosed in a for loop, with sheet name a through A to X. Is this possible?

I tried this:

for letter='A':'X'

[num,txt,raw] = xlsread('Grouting_sum_final.xlsx','%s',letter);

% Lots of code  below here (not relevant for the problem)

end

Upvotes: 0

Views: 250

Answers (1)

pacta_sunt_servanda
pacta_sunt_servanda

Reputation: 734

Yes, it is, but you do not need the '%s' part of your line.

If you go to the documentation website, you will find that you have to pass as first argument the excel file name and as second the sheet name.

So your code should read something like:

for letter='A':'X'

[num,txt,raw] = xlsread('Grouting_sum_final.xlsx',letter);

% Lots of code  below here (not relevant for the problem)

end

Also, I am assuming you are aware that you keep on overwriting your data retrieved from the Excel sheet.

Upvotes: 1

Related Questions