MATLAB: How to input an image in GUI, coming from anywhere in the computer

guideimages

What i meant to say was that i wanted to ask the user to input any image from any folder in his computer, it could be either in 'Pictures', 'Documents', etc. Basically anywhere. Can you help me with this? I used this, but it only allowed me to input images from my workplace:
A = uigetfile('*.jpg;*.png');

Best Answer

Please read the documentation of uigetfile, if you have a corresponding question. You will find:
[FileName, PathName] = uigetfile('*.jpg;*.png');
if isequal(FileName, 0)
disp('User aborted choosing a file');
return; % Or what ever
end
File = fullfile(PathName, FileName);
Now File contains the path also and you can select files from anywhere.