matlab app designer table logical data

조회 수: 5 (최근 30일)
Cem SARIKAYA
Cem SARIKAYA 2019년 5월 17일
답변: Riya 2025년 2월 27일
Hi, I want to be able to select only one of these checkboxes at the same time. How can i do it?
tablearray_data_logical.png

답변 (1개)

Riya
Riya 2025년 2월 27일
Hi,
I understand that you want to allow only one checkbox to be selected at a time. To do this, you can consider using “radio buttons” instead of checkboxes because they allow only single selection. If you prefer checkboxes, you can implement the following logic in their callback functions:
function CheckBoxCallback(app, event)
% Get all checkboxes
checkboxes = [app.CheckBox1, app.CheckBox2, app.CheckBox3];
% Find the checkbox that was clicked
clickedCheckbox = event.Source;
% Uncheck all other checkboxes
for i = 1:length(checkboxes)
if checkboxes(i) ~= clickedCheckbox
checkboxes(i).Value = false;
end
end
end
Click each checkbox and in the “Callbacks” tab, set the ValueChangedFcn property to “CheckBoxCallback”. This will ensure that only one checkbox is selected at a time.
Thanks!

카테고리

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