Select all the data in listbox using single click of pushbutton

3 次查看(过去 30 天)
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'.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by