Hi guys,
I have a GUI with inputs and a plot. I want to print this ideally to PDF. Is this possible?
Thanks

 채택된 답변

Geoff Hayes
Geoff Hayes 2016년 3월 5일
편집: Geoff Hayes 2016년 3월 5일

0 개 추천

A - a GUI is a figure, so you can use print to save it as an image or as a PDF. For example, I would launch my GUI as
h = myGui;
where h is the handle to the GUI. Then to print this to file, I would use
print(h,'myGuiImageFilename','-dpdf');
or whichever format you wish. You may find that some experimentation is required to get the image of the GUI to appear as desired. Sometimes, it is just easier to do a (for example) Windows or Mac screen capture of the (running) GUI and use that captured image within your file.
If this occurs from within a pushbutton callback of the GUI, then there is no need for the h parameter. You could just use the GUI figure handle instead
function pushbutton_Callback(hObject, eventdata, handles)
print(handles.figure1,'myGuiImageFilename','-dpdf');
or whatever the Tag property has been set to for your figure.

댓글 수: 4

Olaleye  Benjamen
Olaleye Benjamen 2018년 11월 26일
Hi sir
am actually working on the same programe byt i want to print my pwn GUI witg all tge result in it
Jan
Jan 2018년 11월 26일
@Olaleye Benjamen: You can do this with the provided code. Therefore I do not understand the purpose of your comment.
Roberto
Roberto 2020년 6월 2일
Hi... I am struggling with the same problem.
So far I am able to save the GUI figure into a PNG file, but the result is weird.
The GUI does not handle the 'PaperPositionMode' or any of these commands.
you can try, but the result isn't pretty.
[File,Path] = uiputfile('*.png');
FileOUT = [Path File];
print('-dpng','-r72',FileOUT)
Roberto
Roberto 2020년 6월 2일
partial solution.... open the GUI using the guide command and just go to the properties editor and set the PaperPositionMode in auto.
That should do the trick.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

질문:

A
A
2016년 3월 3일

댓글:

2020년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by