Clear Filters
Clear Filters

Select all the data in listbox using single click of pushbutton

3 views (last 30 days)
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.

Accepted Answer

Chris Perkins
Chris Perkins on 16 Nov 2017
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'.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!