reset "listbox"

7 ビュー (過去 30 日間)
Rahma Yeni
Rahma Yeni 2012 年 4 月 19 日
編集済み: Image Analyst 2022 年 1 月 22 日
Hello... ^^ i want to reset data from a "listbox"... Before, i got the data from combined string of "popupmenu" like my question in http://www.mathworks.com/matlabcentral/answers/31729-make-history.. How i can remove all list in "listbox" using a button..?? I have tried some code like in http://www.mathworks.com/matlabcentral/answers/23856-reset-button, but, when i do my function again, the list that i got before, are come back... How i can remove them..?? Thank you so much.. :)

回答 (3 件)

Rahma Yeni
Rahma Yeni 2012 年 4 月 19 日
Thank you Friedrich ^^, I have tried your code.. but it doesn't work like i want... :( it just remove temporary... I have tried use:
hListBOx = [];
it can remove all, but i can't input the other string :( .. So, i want to remove all, but i can input other string too... Thank you before.. ^^
  2 件のコメント
Friedrich
Friedrich 2012 年 4 月 19 日
my above example deletes the content and adds new one. iam not sure what you want exactly.
Rahma Yeni
Rahma Yeni 2012 年 4 月 20 日
thank you for your participation Friedrich.. ^^ After consideration, I did not erase these data, but I replaced it with another way..

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


Anthony Miranda
Anthony Miranda 2022 年 1 月 22 日
hListBOx = [];

Image Analyst
Image Analyst 2022 年 1 月 22 日
編集済み: Image Analyst 2022 年 1 月 22 日
I believe both of the other answers are wrong. They will totally delete/remove the listbox, which I don't think is what was wanted. I think the original poster simply wanted to clear out the contents of the listbox.
To do that you don't set the handle of the listbox to null,
hListBOx = []; % Deletes listbox.
you set the String property of the listbox to null
hListbox.String = []; % Clears contents of listbox but leaves an empty listbox on the GUI.
Using GUIDE with a Listbox with tag lstFileList (or whatever you have):
handles.lstFileList.String = [];
or in App Designer:
app.lstFileList.String = [];

カテゴリ

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