Search this blog!

Showing posts with label uigetfile. Show all posts
Showing posts with label uigetfile. Show all posts

Thursday, February 2, 2012

How may I make the user to browse and select file in Matlab


Very often, Matlab programs need to specify input files or images. Instead of giving the absolute path to that file we may make the user to browse and locate the file.

uigetfile is the function that can do that job. Here is an example.

disp('Select the Reference view');
[filename_ref,pathname_ref] = uigetfile('*.*','Select the Reference view');
if isequal(filename_ref,0)
    disp('User selected Cancel')
else
    disp(['Reference view: ', fullfile(pathname_ref, filename_ref)])
end