我有许多 Excel 工作表,我想在 for 循环中循环,工作表名称为 a 到 A 到 X。这可能吗?
我试过这个:
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
是的,它是,但您不需要行中的 '%s' 部分。
如果您访问文档网站,您会发现您必须将 excel 文件名作为第一个参数传递,并将工作表名称作为第二个参数传递。
所以你的代码应该是这样的:
for letter='A':'X'
[num,txt,raw] = xlsread('Grouting_sum_final.xlsx',letter);
% Lots of code below here (not relevant for the problem)
end
另外,我假设您知道您一直在覆盖从 Excel 工作表中检索到的数据。