Hello everyone !
I created a uitable with guide. I created 2 columns : the first one with numbers and the second one with checkboxes.
I would like a function to run when checkboxes are checked, and another function to run when checkboxes are unchecked.
My problem is that I don't know how I can retrieve the value (0 or 1) of my checkboxes.
Can someone help me ?
Thanks

 採用された回答

Adam Danz
Adam Danz 2019 年 7 月 26 日
編集済み: Adam Danz 2019 年 7 月 26 日

0 投票

You can add a CellEditCallback function to the UITable that is evoked every time a cell in the UITable is edited. The 2nd input to this callback function contains the "Indices" field that shows you which indices of the table were just changed.
The first thing you can do in the callback function is to determine if the changed indices were a checkbox. If no, return and end the callback execution. If yes, run your function.
Feel free to follow up with any questions etc.

3 件のコメント

Reeny
Reeny 2019 年 7 月 27 日
編集済み: Reeny 2019 年 7 月 27 日
Thanks for your answer, I will try.
How can I determine if the changed indices were a checkbox ?
Adam Danz
Adam Danz 2019 年 7 月 27 日
編集済み: Adam Danz 2019 年 7 月 29 日
You know what column contains checkboxes. For example, if checkboxes are in column 3, if the changed indices are [2,3] (row 2, column 3) then a checkbox was changed. Feel free to follow up with questions if you get stuck.
Reeny
Reeny 2019 年 7 月 29 日
編集済み: Reeny 2019 年 7 月 29 日
Thanks for your answer, it works

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2016b

質問済み:

2019 年 7 月 26 日

編集済み:

2019 年 7 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by