Unable one of the options of drop down
4 次查看(过去 30 天)
显示 更早的评论
Hi, please help me!
I wanna disable one of the options of drop down 2 when i chose a particular option on drop down 1. what should the codes be? ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1476161/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1476161/image.png)
0 个评论
采纳的回答
Mrutyunjaya Hiremath
2023-9-7
编辑:Mrutyunjaya Hiremath
2023-9-7
You can use 'set' to change the 'Enable' property of the dropdowns in the callback functions.
Here's how you can modify the code to include lines -
% Callback function for the first dropdown
function firstDropdownCallback(~, ~)
% Disable the second dropdown
set(secondDropdown, 'Enable', 'off');
% Enable the first dropdown (in case it was disabled)
set(firstDropdown, 'Enable', 'on');
end
% Callback function for the second dropdown
function secondDropdownCallback(~, ~)
% Disable the first dropdown
set(firstDropdown, 'Enable', 'off');
% Enable the second dropdown (in case it was disabled)
set(secondDropdown, 'Enable', 'on');
end
3 个评论
Mario Malic
2023-9-8
You will have to remove the dropdown item, otherwise try with button group component.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!