Get the selected value in a popup menu with a set
Show older comments
Hello,
Is is possible to set the list of the popup menu (with set(handles.....)) and still get which one is selected? I did use set to have my different choices in the popup menu. But when i want to know which one is selected, it gives me the list that i had set... How can i get the selected value only?
if true
te = T(:,3); %one column of an excel file with number (101-109, 201-209,...409)
set(handles.popupname, 'String', table2array(te));
end
Thank you
Accepted Answer
More Answers (1)
Image Analyst
on 3 Apr 2018
Try this:
allItems = handles.popupname.String; % A cell array of all strings in the popup.
selectedIndex = handles.popupname.Value; % An integer saying which item has been selected.
selectedItem = allItems{selectedIndex}; % The one, single string which was selected.
1 Comment
jacques baptiste
on 5 Apr 2018
Categories
Find more on Interactive Control and Callbacks 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!