Saving pdf (png) with user adding the name

1 Ansicht (letzte 30 Tage)
Alexandra Topciov
Alexandra Topciov am 10 Sep. 2015
Kommentiert: Hamoon am 10 Sep. 2015
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)

Akzeptierte Antwort

Hamoon
Hamoon am 10 Sep. 2015
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 Kommentare
Alexandra Topciov
Alexandra Topciov am 10 Sep. 2015
Thank you very much!:D
Hamoon
Hamoon am 10 Sep. 2015
My pleasure :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by