MATLAB: Error in popupmenu and push button

popupmenu

Warning: popupmenu control requires a scalar Value
Control will not be rendered until all of its parameter values are valid
> In openfigLegacy at 120
In gui_mainfcn>local_openfig at 286
In gui_mainfcn at 158
In Finaldraft at 42

Best Answer

Somehow you have a uicontrol('style','popup') whose Value property is either [] or not a scalar. This would not be the default for such a control (the default is 1), and is not caused by there being an empty String property (you get a different warning for that.) Your code must be changing the Value property itself.
Note that the Value property for a uicontrol of style popup or listbox is which entry (popup) or entries (listbox) is selected, as indices into the cell string. Sometimes people use popups or listbox with strings that happen to look like numbers and then they try to use a Value property which is the numeric value of the string they want to be selected; this is wrong. Sometimes people use a Value which is the string they want selected; this is wrong too. The Value needs to be the numeric index (popup) or vector of indices (listbox) regardless of what the strings happen to look like.
Another potential issue is that if you have a uicontrol('style', 'listbox') and you set its style to be popup then if the Value property was before a vector of values (because in general listboxes can have multiple items selected) then you need to change the Value property to just a single index (because popup cannot have multiple items selected.)