Clear image from axes in matlab GUI

I have a button named 'clear' and within it, i tried the following for clearing image from current axes:
delete(get(handles.axes1,'Children'))
cla(handles.axes1,'reset')
cla(handles.axes1)
Trying all these separately, my image doesn't get cleared from the axes in actual i.e. (axes doesn't get white again). But yes that axes is selected again.
How can this clearance be done?
Thanks

Réponses (2)

Image Analyst
Image Analyst le 19 Déc 2013
Maybe try this:
axes(handles.axes1);
hold off;
cla reset;
What you're saying sounds strange. I've never had a case where I can see an image being displayed in an axes and that does not vanish and get replaced by white when I do a cla('reset'). Are you sure you've referenced the correct axes? What name shows up on it in GUIDE? Does it say axes1? Or something else?

2 commentaires

timothy lienanto
timothy lienanto le 18 Nov 2020
how do i reset the table information to like x and y number
Image Analyst
Image Analyst le 18 Nov 2020
What table? Do you mean tick marks and tick labels outside the image?

Connectez-vous pour commenter.

Walter Roberson
Walter Roberson le 19 Déc 2013
Before you do that, try
findobj(handles.axes1, 'type', 'image')
and see if the image shows up. Then try
imgs = findall(0, 'type', 'image');
imgs_parent = get(imgs, 'Parent');
imgs_elsewhere = imgs_parent(handles.axes1 ~= imgs_parent);
if isempty(imgs_elsewhere)
disp('No other images')
else
disp('Images also found in axes:');
imgs_elsewhere
end

1 commentaire

Raisa Qadir
Raisa Qadir le 19 Déc 2013
I havn't checked it but will soon respond. Thanks

Connectez-vous pour commenter.

Commenté :

le 18 Nov 2020

Community Treasure Hunt

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

Start Hunting!

Translated by