For Loop in Command Window Not Working - But Code Works Line-By-Line?
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!