App Designer: interrupt while loop in running callback by a SPECIFIC interrupting callback (push button)

14 ビュー (過去 30 日間)
Dear All,
I have two buttons, each associated with a function callback. When the 1st button is pressed, the code enters a while loop to update a global property. How do I interupt the while loop and exit function 1, when and only when button 2 with its function XButtonPushed(app, event) get activated? In other answers, introducing a small pause or drawnow() should do it (verified that button 1 callback is interruptible, 'on'), but that method is not specific to a certain button (XButtonPushed(app, event)), any button would lead to interruption. How do a specifically instruct 1st callback about a specific button2?
Something like
loopy = true;
while loopy ==true
% do smth
if % button2 pushed,
loopy = false;
continue
end
end
I tried
if XButtonPushed(app, event) ..., but I get an error about too many output arguments for XButtonPushed.
Thank you,
OL
  1 件のコメント
Mohammad Sami
Mohammad Sami 2020 年 3 月 20 日
See my answer below. you can create a statebutton and use its value in the while loop.
https://www.mathworks.com/matlabcentral/answers/507780-wait-for-a-button-to-be-pressed-to-continue-the-function-app-designer

サインインしてコメントする。

回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by