Wait for a button to be pressed to continue the function - APP DESIGNER

6 ビュー (過去 30 日間)
Hi, there. I have the following problem. I have a callback created that calculates a number of things. When I'm calculating a particular thing, what I want is for the execution to stop until I press another button. And once I've pressed it, go on. I tried waitfor but to no avail...
The code will be something like…
% Button pushed function: Button
function ButtonPushed(app, event)
disp('A')
wait for button2 pushed
disp('B')
end
And I don't want to create an uifigure.

採用された回答

Mohammad Sami
Mohammad Sami 2020 年 2 月 27 日
Instead of a button, you can change it to a state button in app designer
Then in your code just use a while loop to check the value of the state button is 1 before continuing with the rest of your code.
while(app.statebutton.Value ~=1)
pause(1);
end
app.statebutton.Value = 0;
%rest of your code
  4 件のコメント
Lennard Nörthemann
Lennard Nörthemann 2021 年 8 月 19 日
Thanks, it helped me as well!
Sai durga rithvik Oruganti
Sai durga rithvik Oruganti 2022 年 4 月 21 日
Thank you, This was very helpful

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHistorical Contests についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by