Using a for loop to hide multiple components on app designer

I'm a beginner at app design. I am making an app that requires to hide some spinner components:
app.Spinner1.Visible = 'off'
app.Spinner2.Visible = 'off'
app.Spinner3.Visible = 'off'
Is there a way to use a for loop or anything else to reduce the the amount of code?

1 件のコメント

Adam Danz
Adam Danz 2023 年 4 月 30 日
Better than a loop:
objs = [app.Spinner1, app.Spinner2, app.Spinner3];
set(objs, 'Visible','off')
If you're objects are groupped, put them in a uipanel as Cris suggested.

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

 採用された回答

Cris LaPierre
Cris LaPierre 2023 年 4 月 29 日

1 投票

No, a for loop wouldn't help here. If your design allows for it, you could place all the spinners on a panel, and toggle the visibility of the panel, thereby showing or hiding all the spinners on it at once.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品

リリース

R2023a

タグ

質問済み:

2023 年 4 月 29 日

コメント済み:

2023 年 4 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by