Errors when I close GUI

1 次查看(过去 30 天)
Michael Adelman
Michael Adelman 2012-7-9
I created a togglebutton in GUI and used while get(hObject,'Value') to get into the loop.
While the togglebutton is pressed the loop is running and if I want to close the gui window while the loop is running I get following errors:
??? Error using ==> plot Data must be a single matrix Y or a list of pairs X,Y
Error in ==> Voice_measure_gui>Start_Callback at 115 plot(handles.time_domain,time,data)
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> Voice_measure_gui at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)Voice_measure_gui('Start_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
The intention of the code is to sample voice speech and to plot its time domain and freq. domain in real time.
Please advice
  2 个评论
Luffy
Luffy 2012-7-9
Does delete() help you, if not try to use break
Michael Adelman
Michael Adelman 2012-7-9
Hello Luffy,
I tried delete, the effect is the same. break mostly used in 'while'or 'for' loops. When I hit close figure, how to know that I pressed the close figure button?

请先登录,再进行评论。

回答(2 个)

Michael Adelman
Michael Adelman 2012-7-9
hello Jan,
can you suggest a small code that clarify your answer (I'm not so strong in GUI coding).
Thanks,

Jan
Jan 2012-7-9
So you have to stop the loop, before the figure is closed. The CloseRequestFcn is the best place for code to cleanup.

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by