I want to delete a scatter plot's items for multiple times. My code is like
Function plot_callbacks (hObject, eventdata, handles)figure (5)scatter(x,y,'x')hold onscatitem = get(gca, 'Children');handles.scatitem = scatitem;guidata(hObject,handles)Function undo_callbacks (hObject, eventdata, handles)scatitem = handles.scatitem;should_continue = truewhile truedelete(scatitem(1))scatitem(1) = []should_continue = 0end
In the second callback function, the line
delete(scatitem(1))
, just by it-self, deletes the last item, but just for one time. By the second function, I am trying to do the deletion for several times.
Does anyone know where did I write the code incorrectly? How can I make it working?
Best Answer