plotting within a for loop
2 次查看(过去 30 天)
显示 更早的评论
I have a for loop that takes 2 matrix 365x24 and plots each corresponding matrix line ,i.e. X(3,1:24) and Y(3,1:24), and plots it. I would like to be able to have a figure for every iteration so i can come back to it a look for it. In the long run i should have 365 accessible figures in the workspace. And if i can then take these 365 figures and store then in a folder
0 个评论
采纳的回答
Azzi Abdelmalek
2013-2-17
编辑:Azzi Abdelmalek
2013-2-20
for k=1:365
h=plot(X(k,:),Y(k,:))
hgsave(h,'sprintf('fig%d',k))
close
end
To load your plots use
hgload('figurename')
5 个评论
更多回答(1 个)
Image Analyst
2013-2-17
You might want to save them as PNG files so that you can see them in the operating system as thumbnails, that is, if you don't need to interact with them via the figure toolbar anymore.
yourFolder = pwd; % Or whatever folder you want to store them in.
for k=1:365
cla;
plot(X(k,:),Y(k,:));
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
baseFileName = sprintf('Figure #%d.png', k);
fullFileName = fullfile(yourFolder, baseFileName);
export_fig(fullFileName);
end
3 个评论
Walter Roberson
2013-2-21
Image Analyst did say you needed to download export_fig, and even gave you the URL.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!