フィルターのクリア

Saving Multiple matlab files using print

4 ビュー (過去 30 日間)
friet
friet 2021 年 4 月 21 日
回答済み: Richard Quist 2021 年 11 月 29 日
Hello
I am using this to save a multiple figures in ps format.
for i=1:14
print(figure(i), '-append', '-dpsc2', 'd:Myfigure.ps');
end
However, i would like to define the figure paper position, so when i use the code below, doent work :(
h=gcf;
set(h,'PaperOrientation','landscape');
set(h,'PaperUnits','normalized');
set(h,'PaperPosition', [0 0 1 1]);
for i=1:14
print(gcf, figure(i), '-append', '-dpsc2', 'd:Myfigure.ps');
end
ANny help is appreciated. Also, can i save it directly to pdf instead of ps.
Thanks
  2 件のコメント
Xingwang Yong
Xingwang Yong 2021 年 4 月 22 日
export_fig may help.
J. Alex Lee
J. Alex Lee 2021 年 4 月 22 日
You may also need to use the figure's "Position" property to match the "PaperPosition" property.
It's hard to say because "doesn't work" is so vague...does it throw an error? is the result not as expected?

サインインしてコメントする。

回答 (1 件)

Richard Quist
Richard Quist 2021 年 11 月 29 日
My guess is that you are receiving an error from the call to the print function:
for i=1:14
print(gcf, figure(i), '-append', '-dpsc2', 'd:Myfigure.ps');
end
The issue is that you are passing in 2 figure handles in the call to print (gcf and figure(i)). You probably want to remove gcf and use this instead:
for i=1:14
print(figure(i), '-append', '-dpsc2', 'd:Myfigure.ps');
end
The print function can not produce multipage PDF directly, but in R2021b the exportgraphics function was updated to directly support appending to PDF files (i.e. creating a multipage PDF file):
% append each of the figures to output.pdf
for i=1:14
exportgraphics(figure(i), 'output.pdf', 'Append', true);
end

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by