Saving multiple figures all at once
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am running a program that generates 50+ figures.
First: Is there a way where I can resize the viewing window for all of the figures without doing it one at a time?
Second: Is there a way I can save them all at once into a PDF? Doing 'File -> Save as...' for each figure gets time consuming.
thanks!
Adrian
0 commentaires
Réponses (1)
Geoff
le 2 Avr 2012
You'll want to do it in a loop. First, make sure you have stored the handles to your figures in a vector.
figures = [];
% Generate figures
%[your code]
% Resize and output figures
figSize = [21, 29]; % [width, height]
figUnits = 'Centimeters';
for f = 1:numel(figures)
fig = figures[f];
% Resize the figure
set(fig, 'Units', figUnits);
pos = get(fig, 'Position');
pos = [pos(1), pos(4)+figSize(2), pos(3)+figSize(1), pos(4)];
set(fig, 'Position', pos);
% Output the figure
filename = sprintf('Figure%02d.pdf', f);
print( fig, '-dpdf', filename );
end
You can read more about the print command here:
doc print
0 commentaires
Voir également
Catégories
En savoir plus sur Printing and Saving dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!