listbox count items help

조회 수: 2 (최근 30일)
Jason
Jason 2014년 9월 15일
댓글: Jason 2014년 9월 15일
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'.

채택된 답변

Adam
Adam 2014년 9월 15일
편집: Adam 2014년 9월 15일
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.
  댓글 수: 1
Jason
Jason 2014년 9월 15일
perfect, thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by