フィルターのクリア

How the user can save his result(gui) in a folder that he wanted??

2 ビュー (過去 30 日間)
slumberk
slumberk 2011 年 2 月 21 日
Hye guyz. You all here realy help me with matlab since i am a beginner. Now i know a little bit about gui in matlab. I have a question. i have a figure of gui and a save button. I did this coding:
filename = inputdlg('Please enter the name for your figures');
extensions = {'fig','bmp'};
for k = 1:length(extensions
saveas(gcf, filename{:}, extensions{k})
set(gcf,'PaperPositionMode','auto')
end
But this only can save at the folder of my gui. How i want to make the user can choose which folder that he want to save the gui in .bmg file??

採用された回答

Paulo Silva
Paulo Silva 2011 年 2 月 21 日
This should work on Windows OS, don't know how to do it for other OS.
filename = inputdlg('Please enter the name for your figures');
extensions = {'fig','bmp'};
dname = uigetdir('C:'); %you can change C: to other directories
%or even use a edit box where the user can select the default path
for k = 1:length(extensions)
saveas(gcf, [dname '\' filename{:}], extensions{k})
set(gcf,'PaperPositionMode','auto')
end
  2 件のコメント
slumberk
slumberk 2011 年 2 月 21 日
@paulo: thx.. it works!!
Kenneth Eaton
Kenneth Eaton 2011 年 2 月 21 日
You can use the function FULLFILE to make the filepath creation OS-independent: http://www.mathworks.com/help/techdoc/ref/fullfile.html

サインインしてコメントする。

その他の回答 (1 件)

Robert Cumming
Robert Cumming 2011 年 2 月 21 日
see
uigetfile
where you can extract the path that the user requests.

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by