How to find the item order number in List Box in App designer?

조회 수: 3 (최근 30일)
Faez Alkadi
Faez Alkadi 2019년 9월 17일
댓글: Seonggon Kim 2023년 2월 18일
I have a List box named "Numbers" that has the same 4 items, they all are the number 5. How can I pick the Item3 (The third in order) to change it to 3.
I used [~,idx] = ismember(app.NumbersListBox.Value,app.NumbersListBox.Items);
But I alwyas get to change the first on because the Value are the same.
How can I find inx using "Item number" instead of "Value" ?
Thank you so much
  댓글 수: 14
Faez Alkadi
Faez Alkadi 2019년 9월 22일
app.NumbersListBox.ItemsData=1:1:length(app.NumbersListBox.Items);
So whenever I add an Item, The ItemData length changs automatically.
and then whenever I pick an Item to change, I can find its index as
[~,idx] =ismember(app.NumbersListBox.Value,app.NumbersListBox.ItemsData);
Seonggon Kim
Seonggon Kim 2023년 2월 18일
If there are items with same name, is there a way out?
I recommand to use the 'Table' instead 'List Box'.
app.table.Selection

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by