Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How do I change the image displayed in the axes of a gui?

Asked by Tola on 9 May 2013

On the gui, I have push buttons and an axes. The first push button loads an image into the axes. The second is supposed to perform some function on the first image then display the resultant image to the same axes. But I dont understand how to change the image in the axes to the new one. How do I do this? Thank you.

0 Comments

Tola

Tags

Products

No products are associated with this question.

3 Answers

Answer by David Sanchez on 9 May 2013

Your problem has been explained before, I hope the link helps you out:

http://www.mathworks.de/matlabcentral/newsreader/view_thread/33494

0 Comments

David Sanchez
Answer by Image Analyst on 9 May 2013

Just use image() or imshow(). As long as you have just one axes (as you seemed to indicate), it should display just fine. Use cla beforehand to clear out any old image, otherwise the images will "pile up" in the control.

cla;
axes(handles.axesImage); % Only needed if you have multiple axes.
imshow(yourImage);

0 Comments

Image Analyst
Answer by Jurgen on 9 May 2013

Agree with Image Analyst, you can use the same command as with the first button to display. Alternatively changing the CData property of you image may be a faster alternative.

imh = imhandles(your_gui_handle); %gets your image handle if you dont know it
set(imh,'CData',NEWIMAGE);

0 Comments

Jurgen

Contact us