Reset uitable data

16 ビュー (過去 30 日間)
Guilherne
Guilherne 2011 年 12 月 2 日
回答済み: bekir poyraz 2019 年 5 月 29 日
Hy, i'm trying to reset the uitable of my GUI but its not working, I used:
set(handles.uitable,'Data','');
It apparently clean the data, but it also doesnt allow me to edit the uitable anymore. I had also used the function "reset":
reset(handles.uitable), But it didnt work either.

採用された回答

Walter Roberson
Walter Roberson 2011 年 12 月 2 日
Try
set(handles.uitable, 'Data', cell(size(get(handles.uitable,'Data'))));
  6 件のコメント
Walter Roberson
Walter Roberson 2016 年 6 月 23 日
uitable 'data' property takes a cell array, each element of which can be a string or numeric. The cellfun(@ischar, newd) runs through each cell entry and tests to see if it is string or not, returning true if it is and false otherwise. The result, charlocs, is the same size as the cell array but is true for the places that were strings and false otherwise. This logical mask is then used to set those places that were strings to be empty strings, and the negation of the logical mask is used to set the other locations to empty arrays. In this way each local is set to the empty version of what it was before, which preserves information about whether the entry was a string or not.
ElizabethR
ElizabethR 2016 年 6 月 24 日
hi Walter, thanks for answare my question. Thank you so much for your explanation. God Bless You ^^

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

その他の回答 (2 件)

aveks Gebastyan
aveks Gebastyan 2018 年 8 月 12 日
HI Walter Roberson. thanks for answer.. I have problem same how reset uitable. but it has been solved with your answer above....I have problem again, how to reset or remove checklist on the checkbox?. because I use the checkbox for insert data to uitable. so if we reset data in uitable, the cheklist in checkbox must be lost...
thanks..
  5 件のコメント
aveks Gebastyan
aveks Gebastyan 2018 年 8 月 12 日
thanks for answare my question. Thank you so much for your explanation. God Bless You..it's work..
aveks Gebastyan
aveks Gebastyan 2018 年 8 月 12 日
yes, my question about uicontrol checkbox.
set(handles.checkbox1, 'Value', 0)
thanks this work..

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


bekir poyraz
bekir poyraz 2019 年 5 月 29 日
set(handles.uitable, 'Data', cell(size(get(handles.uitable,'Data'))));
thank you

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by