Saving multiple figures all at once
8 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Geoff
2012 年 4 月 2 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Printing and Saving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!