how to show images in GUI matlab

11 Ansichten (letzte 30 Tage)
mutia
mutia am 28 Mai 2014
Kommentiert: Image Analyst am 9 Jul. 2022
I have 4 images, I want to show in axes1, axes2, axes3 axes4, how to build the code?
I use this code, but cannot
g= imread('kasus5.png');
axes(handles.axes1)
imshow(g);
h= imread('kasus6.png');
axes(handles.axes2)
imshow(h);
the result : the picture is shown in figure , not in axes, but when I use 1 axes, that picture can be shown in axes, what happen? please help me, i cannot use multiple axes
  4 Kommentare
Geoff Hayes
Geoff Hayes am 29 Mai 2014
Do you get an error message when you are using two or more axes that is preventing the images from being shown, or does nothing happen? It will be challenging to solve your problem without being able to see the code… Are handles.axes1 and handles.axes2 valid?
mutia
mutia am 29 Mai 2014
thank you for your answer @Geoff Hayes nothing happen,I didn't get error message, if I click push button,the pictures being shown not in axes.
and i tried to used the one axes, the code like that g = imread('kasus5.png');
axes(handles.axes1)
imshow(g); the picture can be shown in axes,.what happen? I'm confused :(

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Geoff Hayes
Geoff Hayes am 29 Mai 2014
mutia - maybe you should just start over with a brand new GUI. I created a very simple one with two axes and a button (I left all with their default names.) I created a callback for the button and modified it to be the following
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = imread('image1.jpg');
J = imread('image2.jpg');
axes(handles.axes1);
imshow(I);
axes(handles.axes2);
imshow(J);
I ran it and it worked fine. Try the above with your GUI and see what happens.
  7 Kommentare
Geoff Hayes
Geoff Hayes am 1 Dez. 2017
Nurye - you may want to provide a small of example of code that demonstrates this problem and post as a new question rather than continuing the conversation here.
Purnendu Nath
Purnendu Nath am 14 Mai 2018
using the function "axes" is the key, as Geoff suggested... and solves the problem (I had the same question and tried what Geoff suggested.. works!)

Melden Sie sich an, um zu kommentieren.


Princiya
Princiya am 9 Jul. 2022
Create gui average filter
  1 Kommentar
Image Analyst
Image Analyst am 9 Jul. 2022
Not sure how this is an answer to @mutia's question.
If you have any questions of your own, then attach your data and code to read it in with the paperclip icon after you read this:
Post it in a totally new discussion thread.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by