필터 지우기
필터 지우기

making checkboxes in uitable mutually exclusive

조회 수: 2 (최근 30일)
Sukuchha
Sukuchha 2012년 1월 5일
Hello,
I have a uitable with four columns and i have set columnformat of one column as logical. By that way i am having checkboxes in uitable.
I now want those check boxes to be mutually exclusive. how it can be done ?

채택된 답변

Aurelien Queffurust
Aurelien Queffurust 2012년 1월 5일
You need to perform this task by using the property CellEditCallback (callback when data in a cell is changed)
  댓글 수: 2
Sukuchha
Sukuchha 2012년 1월 5일
Isnot there, any better way to do ? The way you said, then i have to update data properties of table whenever i click in one of those checkboxes, which is not very optimal !
Titus Edelhofer
Titus Edelhofer 2012년 1월 5일
No, there is no better way. And as long as your table has less then many thousand entries it should work fine.

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

추가 답변 (1개)

Sukuchha
Sukuchha 2012년 1월 5일
thank you for your suggestion.
I implemented the way you showed.
temp = cell2mat(Table_data(:,4));
idx = ~ismember(1:Table_data_rows,row); % row is idx of cell changed
temp (idx) = 0;
Table_data(:,4) = num2cell(temp);
set(hObject,'Data',Table_data);
Whenever my cell is changed, certain calculation are made, the code of which i have put below the code mentioned above. But stragely, my table is updated only after the calculation are finished for CellEditCallback function. While the funciton is running i have two checkboxes in the uitable !
how to overcome this !
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 1월 5일
drawnow() after you set() the value you want to appear.

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

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by