処理実行中のみボタンのテキストを変更するには

4 vues (au cours des 30 derniers jours)
憲志郎 堀内
憲志郎 堀内 le 28 Juin 2022
Commenté : 憲志郎 堀内 le 28 Juin 2022
AppdesignerでGUIアプリの開発をしています。
ボタンをクリックした後、時間のかかる処理を行いたいと考えています。
このときボタンの表示をrun→runningに変更する必要があります。
以下のコードを実行しましたが、ボタンの文字の更新が行われません。
function ButtonPushed(app, event)
app.Button.Text = 'running';
calculate();
app.Button.Text = 'run';
end
文字の変更後、画面をリフレッシュする必要があると思うのですが方法が分かりません。

Réponse acceptée

Kojiro Saito
Kojiro Saito le 28 Juin 2022
drawnowという関数でFigureの表示を更新できます。
calculateの前にdrawnowを入れてみてください。
function ButtonPushed(app, event)
app.Button.Text = 'running';
drawnow
calculate();
app.Button.Text = 'run';
end
  1 commentaire
憲志郎 堀内
憲志郎 堀内 le 28 Juin 2022
素晴らしいです。drawnow一行で解決しました。
ご回答ありがとうございます。

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!