How to change in sequences of files each output of two for loops one inside the other
Show older comments
Hello, I have too "for" loops one inside the other and I would like to save the output in sequences of files. I can do it successfully with one "for" loop, but I do not know how to do it for both With one "for" loop my code is as shown:
for n=0:50:100;
%there is some code here that calculates the variable RESULT%
...
%save files e.g n=0 to n=100
filename=['SF140profilen', int2str(n),'.txt'];
save(filename, 'RESULT', '-ascii');
end
This works, but now I need a loop inside, as shown:
for n=0:50:100;
for m=100:20:200
%there is some code here that calculates the variable RESULT%
%save files e.g n=0 to n=100
filename=['m100profilen', int2str(n),'.txt'];
save(filename, 'RESULT', '-ascii');
?
end
end
I would like to change this 100 in 'm100profilen' to give me the series of files produced buy the loop that changes m. Could you help me please? The names of the files should indicate the increasing values in n and m.
Accepted Answer
More Answers (0)
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!