Why does MATLAB 7.4 (R2007a) and (R2006b) freeze when I open and close an Input Dialog Box (or other graphics objects) in my program till the time the program completes?
1 次查看(过去 30 天)
显示 更早的评论
When the following code is run in MATLAB 7.4 (R2007a) or MATLAB 7.3 (R2006b)
prompt = {'Enter your name:'};
dlg_title = 'Enter your name';
num_lines = 1;
def = {'No name'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
while(1)
1+1; % Dummy endless while loop
end;
an input dialog box is opened. After the input dialog box is closed, the program continues in an endless loop. During this period, MATLAB desktop stops responding after a few seconds. As a result it is not possible to access any of the MATLAB desktop windows like MATLAB Editor, MATLAB command window etc. It is also not possible to escape the program using Ctrl+C.
This behavior is not observed in MATLAB 7.2 (R2006a) and earlier versions.
采纳的回答
MathWorks Support Team
2012-12-13
This is a bug in MATLAB 7.4 (R2007a) and MATLAB 7.3 (R2006b) in the way MATLAB desktop graphics are refreshed during program execution.
To work around this issue, the MATLAB desktop should be refreshed using the DRAWNOW command after the input dialog box (or other graphics objects) are operated on. An example implementation is shown below:
prompt = {'Enter your name:'};
dlg_title = 'Enter your name';
num_lines = 1;
def = {'No name'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
drawnow;
while(1)
1+1;
end;
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!