i have a loop that generates an image everytime how can I save the figures?
    3 次查看(过去 30 天)
  
       显示 更早的评论
    
Hi, my code is the following but its saving each image with the same name I want the name to change, How could I do it?
  AllFigH = findall(groot, 'type','figure')
for iFig = 1:numel(AllFigH)
  fig = AllFigH(iFig);
  Folder = ('C:\Users\vicen\Desktop\TFG  Vicenç\Imagenes\Imagenes Geoscatter\DIA 1');
  FileName = sprintf('%03d.png',iFig); % <----- 
  saveas(fig,fullfile(Folder,FileName));
end
0 个评论
回答(1 个)
  Benjamin Kraus
    
 2021-12-31
        
      编辑:Image Analyst
      
      
 2021-12-31
  
      I can't see any obvious bugs in your code. As written, it should save a copy of all figures that you opened in your loop. Are you sure you have more than one open figure? That's the only reason I can think you would only get one file.
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

