フィルターのクリア

automatic read the file and stop the reading

1 回表示 (過去 30 日間)
renoald Tang
renoald Tang 2012 年 3 月 19 日
hai , my gui have two button - start and pause. when the button start is press , the gui will automatically read all the file with specific extension (let say off) until i press the pause button.
The challenge is :
(1.) How i infinite loop for reading the file ?
r=-1;
while r < 0
//mycode here
end while .
how can i termiate the loop by using pause button ?
let say press pause button , r become > 0
(2.) when in the while loop , i press the pause button , not any effect on the gui!As i know , the pause button only work when the while loop is stop!This mean i can not press the button until the loop is stop , i can not do two thing in same time (Multithreading in programing)! any solution about this ?

採用された回答

Walter Roberson
Walter Roberson 2012 年 3 月 19 日
The solution to #2 is to add a drawnow() statement in your loop. That tells MATLAB that it is okay to process any pending interruptions such as from a button push.
There are numerous ways to communicate the change in r; see for example http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by