Error using matlab.ui.control.UIControl/set Invalid or deleted object inside a while loop
显示 更早的评论
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 个评论
Walter Roberson
2018-2-27
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?
Mafalda Couto
2018-2-28
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!