delete plot from existing plot

5 vues (au cours des 30 derniers jours)
Mr X
Mr X le 14 Fév 2013
A GUI application was developed to display different pcolor plots. I have one graph area and using a scroll bar the user can change from one plot to another. Furthermore, each pcolor plot has a quiver plot displayed on top of it which can be disable via a radio button. However, when I uncheck the radio button the following error occurs:
Error using delete Invalid or deleted object.
Snippet:
windDirStatus = get(hObject,'Value');
axes(handles.graph);
if (windDirStatus)
windDirection = quiver (xaxis,yaxis,windUplot,windVplot);
hold on;
else
% set(windDirection,'Visible','off');
delete(windDirection);
end
As you can see I also tried using set(...) Can somebody help me with this issue?
[EDITED, Jan, code formatted]

Réponses (1)

Jan
Jan le 14 Fév 2013
Without seeing how windDirection is defined, it is impossible to guess, why it is not a valid handle. At least the copy of the complete error message might be helpful instead of a shortened description. However, obviously this variable is not a valid handle of a GUI object.
  1 commentaire
Mr X
Mr X le 14 Fév 2013
Modifié(e) : Mr X le 15 Fév 2013
Hi Jan, thanks for you answered.
So I declared windDirection as a global variable and is being assigned as in the snippet. On the other hand, windDirStatus is a local variable.
The snippet is part of the radio button call back function and the following is whole error:
Error using delete Invalid or deleted object.
Error in menu>windDirectionButton_Callback (line 130) delete(windDirection);
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in menu (line 18) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)menu('windDirectionButton_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Object Properties dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by