Saving pdf (png) with user adding the name
3 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
采纳的回答
Hamoon
2015-9-10
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');
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!