Listdlg freezes but not when debugged; using pause seems to fix
3 views (last 30 days)
Show older comments
I am using matlab R2012B, and using listdlg to allow the user to select which channels need to be processed:
[s,v] = listdlg('PromptString', 'Select Channels to Display',...
'SelectionMode', 'multiple', 'Name','Channel Selection',...
'ListString', handles.DAQ_info.Ch_Names, 'InitialValue', handles.channels);
Sometimes the dialog box would freeze and other times it would work fine. Everytime I would place a debug at or after it there wouldn't be a problem. As a work around I placed a pause(1/4) after it and everything seems to work fine now. Just wondered if anyone has had this issue or knows why this is occuring.
Thanks
Brad
0 Comments
Answers (1)
Sean de Wolski
on 2 Jan 2013
Edited: Sean de Wolski
on 2 Jan 2013
This is expected. One of the features of pause() is that it flushes the event queue so any pending events are taken care of before the code continues. This is the sole purpose of drawnow() so I recommend using drawnow() instead.
The reason it is hanging is because all of the events build up. Matt and I discussed this here: Old Answer
0 Comments
See Also
Categories
Find more on Interactive Control and Callbacks 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!