MATLAB Answers

0

Save Image Files in a loop

Asked by Maria Jaramillo on 28 Jun 2018
Latest activity Answered by D. Plotnick on 28 Jun 2018
Hello,
I have a program that generates certain images and saves them at the end and I have to actually hit save at the end, I am trying to make a loop for the same program, that will override the value of the parameter and save each file every time. I tried a simple for loop but it only saves the file once. when it goes through the first value of the parameter.

  0 Comments

Sign in to comment.

1 Answer

Answer by D. Plotnick on 28 Jun 2018
 Accepted Answer

Something like this should work: just iterate over the save-name for the image.
for i = 1:I
image = doStuff(data);
imagesc(image);
fName = ['fileNameBase_',num2str(i),'.png'];
saveas(gca,fName);
end

  0 Comments

Sign in to comment.