listbox count items help

7 views (last 30 days)
Jason
Jason on 15 Sep 2014
Commented: Jason on 15 Sep 2014
Hi, Im trying to find out how many items are listed in my listbox, I've tried:
lc=get(handles.listbox1, 'count')
But get the following error
Error using hg.uicontrol/get
The name 'count' is not an accessible property for an instance of class 'uicontrol'.

Accepted Answer

Adam
Adam on 15 Sep 2014
Edited: Adam on 15 Sep 2014
str = get( handles.listbox1, 'String' )
lc = numel( str );
If you want to see all the properties of a UI handle object such as a listbox you can just type:
get( handles.listbox1 )
and it will display all the properties in the command window. You can often use that as a way to work out what property you need.

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!