User selects image in gui and selected image goes into axes??

6 ビュー (過去 30 日間)
lc1994
lc1994 2016 年 2 月 25 日
コメント済み: lc1994 2016 年 2 月 25 日
I have a gui, and a push button which the user will click, it will then open and the user will select and image. I then want this selected image to go into the axes. So far this is the code i have, but no images goes into axes after selecting.
i = uigetfile({'*.png';});
axes(handles.axes1)
imshow(i);

採用された回答

Kevin Claytor
Kevin Claytor 2016 年 2 月 25 日
The variable 'i' in your code is the filepath to the image, not the image itself, you still have to load the image:
i = uigetfile({'*.png';});
img = imread(i);
axes(handles.axes1);
imshow(img);
  1 件のコメント
lc1994
lc1994 2016 年 2 月 25 日
it works! perfect, thank you!!

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by