How do I disable a dropdown option?

조회 수: 22 (최근 30일)
hbcukid
hbcukid 2021년 9월 27일
댓글: hbcukid 2021년 9월 29일
On my GUI on the appbuilder I have two dropdown menus with the same options, app.dropdown1 and app.dropdown2. Their Items are a1, a2, a3, and a4. How can I make it so that if I choose an item on dropdown1 it turns the visibility of it off on dropdown2.
Desired output: if dropdown1's value = a1 on dropdown2 only (a2,a3,a4) should be visible

답변 (1개)

Voss
Voss 2021년 9월 28일
str = app.dropdown1.String; % store dropdown1's list of options
str(app.dropdown1.Value) = []; % remove the selected one
app.dropdown2.String = str; % apply it to dropdown2
Run those lines in dropdown1's Callback function. You probably also want to update app.dropdown2's Value property.
  댓글 수: 3
Kevin Holly
Kevin Holly 2021년 9월 29일
try app.dropdown1.Items instead of String
hbcukid
hbcukid 2021년 9월 29일
Matrix index is out of range for deletion

댓글을 달려면 로그인하십시오.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by