MATLAB Answers

How to save Matlab GUI-Window as vector graphics?

4 views (last 30 days)
Ting Sun
Ting Sun on 14 Mar 2018
Commented: Ting Sun on 26 Mar 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

  0 Comments

Sign in to comment.

Answers (1)

Sonam Gupta
Sonam Gupta on 26 Mar 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.

  2 Comments

Ting Sun
Ting Sun on 26 Mar 2018
fig= test_gui.fig;
I tried it, but it shows error ...

Sign in to comment.

Sign in to answer this question.