how to show images in GUI matlab

12 vues (au cours des 30 derniers jours)
mutia
mutia le 28 Mai 2014
Commenté : Image Analyst le 9 Juil 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 commentaires
Geoff Hayes
Geoff Hayes le 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 le 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 :(

Connectez-vous pour commenter.

Réponses (2)

Geoff Hayes
Geoff Hayes le 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 commentaires
Geoff Hayes
Geoff Hayes le 1 Déc 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 le 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!)

Connectez-vous pour commenter.


Princiya
Princiya le 9 Juil 2022
Create gui average filter
  1 commentaire
Image Analyst
Image Analyst le 9 Juil 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by