フィルターのクリア

Listdlg freezes but not when debugged; using pause seems to fix

2 ビュー (過去 30 日間)
Brad
Brad 2013 年 1 月 2 日
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

回答 (1 件)

Sean de Wolski
Sean de Wolski 2013 年 1 月 2 日
編集済み: Sean de Wolski 2013 年 1 月 2 日
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
This also explains why debugging works - when you debug, MATLAB has plenty of time before showing you the debugger to flush any remaining events. Doug likes to call this a Heisenbug, which I kind of like.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by