Load an image which i choose from a spesific folder

34 views (last 30 days)
I'm building a GUI in which i have a button that i want to load an image from specific folder.But i don't want a specific image.I want to have the choise to choose one image that i want(not multiple images just one).Is there any way to push that button open me the folder and choose my image? Images files must be (.bmp) Thanks a lot

Accepted Answer

Bego
Bego on 16 Sep 2016
Edited: Bego on 16 Sep 2016
Hello Thanos!
In your GUI add a EditText (Tag edit1) and a Push button (Tag pushbutton1). Right click over the push button and select View Callbacks/Callback. On the pushbutton1_Callback write something like this:
%Open dialog box and select and image from it
[filename,filepath]=uigetfile({'*.bmp'},'Select and image');
%Set the value of the text field edit1 to the route of the selected image.
set(handles.edit1, 'String', strcat(filepath, filename));
Regards,
  3 Comments
Thanos Lampridis
Thanos Lampridis on 16 Sep 2016
It worked!!!Thanks for the help again!UR the best!!!

Sign in to comment.

More Answers (1)

PRAJWAL GOWDA HM
PRAJWAL GOWDA HM on 13 Jul 2019
[filename,filepath]=uigetfile({'*.bmp'},'Select and image');
selectedImage = imread(strcat(filepath, filename));
imshow(selectedImage);

Community Treasure Hunt

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

Start Hunting!