Hi,
How can I know which rows in a uitable with logical cell (checkbox) were selected (upon clicking a button)?
Thanks.

 채택된 답변

Walter Roberson
Walter Roberson 2013년 12월 10일

0 개 추천

get() the Data property of the table and examine the respective cells.

댓글 수: 6

hu
hu 2013년 12월 10일
편집: hu 2013년 12월 10일
and how do I do it? Thanks
data = get(HandleOfUitable, 'Data');
logical_vec = horzcat(data{:,AppropriateColumnNumber});
disp('rows that were set were:')
find(logical_vec)
hu
hu 2013년 12월 10일
편집: hu 2013년 12월 10일
Thanks a lot. It only give me how much checkboxes were clicked in a consecutive string (e.g.,1 2 3) but not the actual row number, can it be modified to show the row numbers?
Walter Roberson
Walter Roberson 2013년 12월 10일
It works in my test.
hu
hu 2013년 12월 11일
I still not getting the row numbers (I run you code in a GUI). Can you please upload a full example. Thanks
foo = uitable('Data', {false;true;true;false;false}, 'ColumnEdit', true);
Now click on the last entry. Then
data = get(foo, 'Data');
logical_vec = horzcat(data{:});
find(logical_vec)
You should now see that 1 and 4 are not in the list.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

질문:

hu
2013년 12월 10일

댓글:

2013년 12월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by