Get selection index for DropDown object using AppDesigner

143 views (last 30 days)
Jim Hokanson
Jim Hokanson on 10 Nov 2017
Commented: Mario Malic on 19 Feb 2021
Using AppDesigner, how do I access the selected index of a DropDown menu. The Value is the selected string but I can't find anywhere that indicates the selected index. Instead I seem to have to do:
I = find(strcmp(h.Items,h.Value));
Is this really the suggested approach?

Accepted Answer

Matt J
Matt J on 10 Nov 2017
Edited: Matt J on 10 Nov 2017
The h.Value property has different behavior depending on how h.Items and h.ItemsData are set up. If you define the ItemsData property to be some sequence of numeric indices i=1:N, then h.Value will be the numeric value of i corresponding to the selection.
  15 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!