Using a for loop to hide multiple components on app designer

조회 수: 11 (최근 30일)
Degaulle
Degaulle 2023년 4월 29일
댓글: Adam Danz 2023년 4월 30일
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일
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개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by