how to show images in GUI matlab
61 views (last 30 days)
Show older comments
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 Comments
Geoff Hayes
on 29 May 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?
Answers (2)
Geoff Hayes
on 29 May 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 Comments
Geoff Hayes
on 1 Dec 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
on 14 May 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!)
Princiya
on 9 Jul 2022
Create gui average filter
1 Comment
Image Analyst
on 9 Jul 2022
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.
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!