How can I save graphics as pdf?

12 ビュー (過去 30 日間)
Pul
Pul 2021 年 11 月 19 日
コメント済み: Pul 2021 年 11 月 25 日
Hello everyone,
I'd like to save graphics as pdf and I tried in this way, but I can't get what I have to write instead of "myfigure".
Thank you!
saveas(gcf,'myfigure.pdf')

採用された回答

Dave B
Dave B 2021 年 11 月 19 日
編集済み: Dave B 2021 年 11 月 19 日
What you typed should work, it should save the current figure (gcf) as myfigure.pdf to the current directory.
I'd recommend using exportgraphics instead of saveas if you're using 2020a or later. exportgraphics is more modern and is graphics specific.
If you're not finding your pdf, is it possible you're not looking in the correct directory? The directory is shown near the top of the MATLAB desktop, but you can also see it by calling the function pwd.
If you didn't want to save the 'current figure' replace gcf with the figure number. Unfortunately this is slightly more complicated with exportgraphics
saveas(3,'foo.pdf'); % exports figure 3
exportgraphics(figure(3),'foo.pdf'); % exports figure 3
  7 件のコメント
Dave B
Dave B 2021 年 11 月 24 日
@Pul - the current figure is empty, if you're trying to save a specific figure please use the syntax shown in my snippet above.
Pul
Pul 2021 年 11 月 25 日
Okay, thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by