How to deactivate an editable component based on another component in Matlab app?

10 ビュー (過去 30 日間)
Hi,
i'm trying to build an app with a structure as follows:
  • editable 1 (e.g., the input file name)
  • drop down list (leads to 4 available calculation scenarios. The options are 0, 1, 2, 3)
  • editable 2 (e.g., another required input which is only necessary in the case of scenarios 2 and 3)
  • Run button.
My question is, how can I hide/disable/deactivate editable component 2 in the GUI based on the input given in the drop down list?
The scenarios drop down doesn't have to be a drop down.
Thank you in advance.

採用された回答

Chetan Bhavsar
Chetan Bhavsar 2021 年 10 月 1 日
% Value changed function: DropDown
function DropDownValueChanged(app, event)
value = app.DropDown.Value;
if strcmp(value,'Option 2')
app.EditField.Editable = false;
else
app.EditField.Editable = true;
end
end
  2 件のコメント
Kevin Holly
Kevin Holly 2021 年 10 月 1 日
If you have two dropdown boxes:
value = app.DropDown.Value;
if value == 'Option 2' || value == 'Option 3'
app.DropDown2.Editable = 'off';
else
app.DropDown2.Editable = 'on';
end
Hendrawan Aji
Hendrawan Aji 2021 年 10 月 2 日
Thank you for the fast answer.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by