Unable one of the options of drop down

조회 수: 2 (최근 30일)
Amron
Amron 2023년 9월 7일
편집: Amron 2023년 9월 10일
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?

채택된 답변

Mrutyunjaya Hiremath
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
Mario Malic 2023년 9월 8일
You will have to remove the dropdown item, otherwise try with button group component.
Amron
Amron 2023년 9월 10일
편집: Amron 2023년 9월 10일
So, i can't disable one of the options of my dropdown without delete it? Okay thanks bro, i'll try the button group

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by