I have a GUI with a save button, and I would like to open a dialog box where the user can enter the filename and select the format of the file (pdf or png)

 채택된 답변

Hamoon
Hamoon 2015년 9월 10일

0 개 추천

You can use this code inside the Callback function of your save button:
[filename, pathname] = uiputfile({'*.pdf';'*.png';'*.*'},'Save as');
if isequal(filename,0) || isequal(pathname,0)
% user selected cancel button
else
% user selected a pathname and filename
% you can use these variables to save what you want
% in that path and by that name
end
you can also specify a path as default:
[filename, pathname] = uiputfile({'*.pdf';'*.png';'*.*'},'Save as', 'C:\untitle.png');

댓글 수: 2

Thank you very much!:D
Hamoon
Hamoon 2015년 9월 10일
My pleasure :)

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

추가 답변 (0개)

카테고리

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

태그

질문:

2015년 9월 10일

댓글:

2015년 9월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by