how to clear all selected listbox items
Afficher commentaires plus anciens
i have a list box containing 20 items if i have selected 10 items now if i push button all selected list box needs to cleared
setting valuue property to [] makes listbox dissappear
Réponse acceptée
Plus de réponses (3)
Josh Kahn
le 29 Mai 2025
If you receive this error:
Error using matlab.ui.control.internal.model.ExactlyOneSelectionStrategy/validateValuePresentInItemsData (line 238)
'Value' must be an element defined in the 'ItemsData' property.
then try using an empty cell array instead:
listBox.Value = {}
Jan
le 26 Oct 2012
0 votes
Is the disappearing accompanied by a warning message? Please post the corresponding code, because a minimal example, which reproduces your problem, will clear, what you are actually doing. A textual descritpion usually does not contain the bug, which causes the troubles.
In other words: The actual question is: Why does setting Value to [] make the listbox invisible? This is not the expected behavior.
Azzi Abdelmalek
le 26 Oct 2012
set(handles.yourlistbox,'enabled','off')
2 commentaires
Lockywolf
le 15 Avr 2016
An uicontrol has no "enabled" property.
Image Analyst
le 15 Avr 2016
What type of control are you referring to? Listboxes, buttons, checkboxes, radio buttons, edit fields, etc. all most certainly do have an enable property (though setting it to off will not deselect highlighted items in a listbox).
Catégories
En savoir plus sur App Building dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!