From: David Robinson on
Hi

I am going through a video tutorial on the Matlab channel on Youtube. Everything works apart from the popup menu.

When I select the membrane or sinc options I have a problem with the switch statement in the popup callback.

This is how the code is.

function plotPopup_Callback(hObject, eventdata, handles)

val=get(hObject,'Value');
str=get(hObject,'String');
switch str(val)
case 'peaks' %user selects peaks
handles.current_data=handles.peaks;
case 'membrane'
handles.current_data=handles.membranes;
case 'sinc'
handles.current_data=handles.sinc;
end
guidata(hObjects,handles);

and this is the error taken from the command window.

??? SWITCH expression must be a scalar or string constant.

Error in ==> simpleGUI>plotPopup_Callback at 88
switch str(val)

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> simpleGUI at 42
gui_mainfcn(gui_State, varargin{:});

Error in ==>
@(hObject,eventdata)simpleGUI('plotPopup_Callback',hObject,eventdata,guidata(hObject))


??? Error while evaluating uicontrol Callback

If anyone could help me with this I would be very grateful.

Thank you

David
From: Cary Opel on
They also made a mistake in the code:

guidata(hObjects,handles);

which should be:

guidata(hObject,handles);
From: ImageAnalyst on
On Apr 19, 9:42 am, "Dave Robinson" <dave.robin...(a)somewhere.biz>
wrote:
> Whats this - identity theft ;-)
>
> Regards
>
> Dave Robinson
--------------------------------------------------------------------
Well I guess if you're such a talented individual, as you are, then
it's bound to happen.
The truth will eventually prevail though.