For Loop in Command Window Not Working - But Code Works Line-By-Line?
显示 更早的评论
Hi, I am trying to run a for loop in the Matlab command window to open, edit, and save new copies of a group of 217 files I have.
When I run the code within the for loop line-by-line, it works perfectly. When I copy and paste the whole block of code with the for loop included in the command window, no files are opened, edited, or saved.
Any ideas on why the loop wouldn't work?
L7 = Band ('http://fsf.nerc.ac.uk/user_group/bands/Landsat7TM.xml')
for i = 1:217;
str = ['C:\',num2str(i),'.txt']
str2 = ['C:\',num2str(i),'.xlsx']
s = importasd(str)
t = convolve(s, L7)
fields = {'name', 'datetime', 'header', 'wavelength'};
t = rmfield(t,fields)
o = struct2table(t)
writetable(o,str2)
End
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!