How to save Matlab GUI-Window as vector graphics?

1 Ansicht (letzte 30 Tage)
Ting Sun
Ting Sun am 14 Mär. 2018
I want to save the whole Window of GUI as a vector graphic like these
I tried to use
fig=openfig('test_gui.fig');
fig.InvertHardcopy = 'off';
set(fig,'PaperPositionMode','auto');
print(fig,'-dpdf','test_gui.pdf')
But only get the GUI-Frame without Figure in PDF
How can I get both of them as a vector graphic ?
Thanks in advance

Antworten (1)

Sonam Gupta
Sonam Gupta am 26 Mär. 2018
This is happening because the handle 'fig' in your code is pointing only to GUI frame. Use the following code instead:
if true
fig= test_gui.fig;
fig.InvertHardcopy = 'off';
set(fig,'PaperPositionMode','auto');
print(fig,'-dpdf','test_gui.pdf')
end
I hope this helps.
  3 Kommentare
Ting Sun
Ting Sun am 26 Mär. 2018
by using fig=gcf; works! thanks
Ashishkumar Gupta
Ashishkumar Gupta am 9 Jan. 2023
Bearbeitet: Ashishkumar Gupta am 9 Jan. 2023
my Gui file name is plotgraph.mlapp. It does not have .fig extension.!! What's the workaround here?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by