Error using matlab.ui.​control.UI​Control/se​t Invalid or deleted object inside a while loop

2 views (last 30 days)
Hi.
I am trying to continuously (in real time) set a clock string in my guide and plot data in an axes window. all goes fine except when i finish/end the gui this error occurs. Can you help me?
Error using matlab.ui.control.UIControl/set Invalid or deleted object.
Error in log_display6>start_button_Callback (line 84) set(handles.clock,'String' [num2str((c(4))),':',num2str((c(5))),':',num2str(fix(c(6)))]);
Error in gui_mainfcn (line 95) feval(varargin{:});
Error in log_display6 (line 42) gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)log_display6('start_button_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating DestroyedObject Callback.
function start_button_Callback(hObject, eventdata, handles)
(...)
axes(handles.axes4);
hold on;
stop_state=get(handles.end_button,'Value');
while ~isequal(stop_state,1)
c=clock;
* set(handles.clock,'String',[num2str((c(4))),':',num2str((c(5))),':',num2str(fix(c(6)))]);
t1=now;
w=0;
plot(t1,w);
datetick('x','HH:MM');
xlim([t0 t1]);
drawnow;
pause(1);
end
  2 Comments
Walter Roberson
Walter Roberson on 27 Feb 2018
You seem to have a handles.end_button . Is there a callback associated with that?
Is it possible that you are closing the figure that the object in handles.clock is in?

Sign in to comment.

Answers (0)

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!