Enable/disable dropdowns when checkbox checked/unchecked in MATLAB2019A app designer

29 ビュー (過去 30 日間)
Rohit Deshmukh
Rohit Deshmukh 2019 年 11 月 6 日
コメント済み: Kojiro Saito 2022 年 11 月 17 日
Capture.PNG
I want to disable the given dropdown if the checkbox is selected and enable it once checkbox is unchecked.
How should be the code?

回答 (1 件)

Kojiro Saito
Kojiro Saito 2019 年 11 月 6 日
First, add ValueChangedFcn callback from app.CheckBox.
2019116204136.jpg
Then, define CheckBoxValueChanged function as the follows.s
% Value changed function: CheckBox
function CheckBoxValueChanged(app, event)
value = app.CheckBox.Value;
if value == true
% If checkbox is checked, make dropdown disable
app.DropDown.Enable = false;
else
% If checkbox is unchcked, make dropdown enable
app.DropDown.Enable = true;
end
end
Here is a screenshot.
2019116204446.jpg
  9 件のコメント
Paolo Volpe
Paolo Volpe 2022 年 11 月 17 日
I have another question @Kojiro Saito.
If I want to save my output file from the APP designer which function can I use? I didn't find nothing correlated to my question on the web. Thank you
Kojiro Saito
Kojiro Saito 2022 年 11 月 17 日
You can use save (as .mat file), writetable (as .csv or .txt, .xlsx) and so on.
For detail, please read this document (Export Function).
Also, with uiputfile, you can specify the file destination.

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

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by