フィルターのクリア

problem with working the browsing image in gui

1 回表示 (過去 30 日間)
Farjana Yeasmin
Farjana Yeasmin 2014 年 12 月 6 日
コメント済み: Farjana Yeasmin 2014 年 12 月 6 日
I am trying to browse a image using a push button , and the address of the file saved in edit text box, but I can not work the image ... how can i do that ... plz help

採用された回答

Image Analyst
Image Analyst 2014 年 12 月 6 日
Try this snippet to get a filename of an image or file to read in:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = 'C:\Program Files\MATLAB';
if ~exist(startingFolder, 'dir')
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
Use this snippet to specify a file to save:
% Get the name of the file that the user wants to save.
% Note, if you're saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
  3 件のコメント
Image Analyst
Image Analyst 2014 年 12 月 6 日
I did give you the solution. Here it is again:
startingFolder = pwd; % Start in current folder.
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.PNG');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
% Update static text label.
set(handles.edit1,'String', fullFileName);
% Now call imread(fullFileName) or whatever....
Farjana Yeasmin
Farjana Yeasmin 2014 年 12 月 6 日
Thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by