Clear image from axes in matlab GUI
5 views (last 30 days)
Show older comments
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
0 Comments
Answers (2)
Image Analyst
on 19 Dec 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 Comments
Walter Roberson
on 19 Dec 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
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!