plotting within a for loop
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Azzi Abdelmalek
il 17 Feb 2013
Modificato: Azzi Abdelmalek
il 20 Feb 2013
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 Commenti
Più risposte (1)
Image Analyst
il 17 Feb 2013
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 Commenti
Walter Roberson
il 21 Feb 2013
Image Analyst did say you needed to download export_fig, and even gave you the URL.
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!