フィルターのクリア

Select all the data in listbox using single click of pushbutton

3 ビュー (過去 30 日間)
Ghenji
Ghenji 2017 年 11 月 14 日
コメント済み: Ghenji 2017 年 11 月 17 日
I have a GUI with 3 pushbuttons(Load, Select All & Extract)and listboxDATA. I am able to import data in the listbox using load but how do I set callback for select_all to select all the data in the listboxDATA. I can select all the data individually in listbox but that could be more than 200 lines.

採用された回答

Chris Perkins
Chris Perkins 2017 年 11 月 16 日
Hi Ghanshyam,
In your 'Select All' pushbutton callback, you can add the following code to select all elements currently displayed in your listbox:
sizeOfListBox = numel(get(handles.listbox1, 'String'));
set(handles.listbox1,'value',1:sizeOfListBox);
You can replace 'listbox1' with the Tag of your custom listbox.
Note: You will also need to adjust the 'Max' and 'Min' properties of the Listbox so that multiple item selection is allowed. 'Max' must be at least 2 more than 'Min'.
  1 件のコメント
Ghenji
Ghenji 2017 年 11 月 17 日
Hey Chris. I was missing this function 'numel'. Thank you for your help.

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

その他の回答 (0 件)

カテゴリ

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