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

14 views (last 30 days)
Faez Alkadi
Faez Alkadi on 17 Sep 2019
Commented: Faez Alkadi on 22 Sep 2019
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
  13 Comments
Faez Alkadi
Faez Alkadi on 22 Sep 2019
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);

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by