The Value
of a pop-up menu is set to the index of the selected item. So if you've selected the second of three items, the Value
will be 2, and you can fetch it using selectedIdx = get(hObject, 'Value')
.
The String
of a pop-pup menu can be set to either a cell array of strings, one per item; or a character array, with one row per item.
If you've set the String
to be a cell array of strings, you can get the selected item using items = get(hObject, 'String'); selectedItem = items{selectedIdx}
.
If you've set the String
to be a character array, you can get the selected item using items = get(hObject, 'String'); selectedItem = items(selectedIdx, :)
.
Hope that helps!