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 view (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Dec 2012
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;

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2007a

Community Treasure Hunt

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

Start Hunting!