Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

MATLAB GUI Error "Undefined function or variable 'val'"

Asked by Rom

Rom (view profile)

on 21 Aug 2013

I made a GUI using GUIDE.

It contains a Pop-up menu containing 3 items (A,B,C) and a pushbutton.

This very simple Gui is designed to simply display a different text for whichever item the user chooses.

If I select the first value of my pop-up menu, I should get a return print of Hello. Sections of the code can be seen below. Why doesn't the code work?

M-FILE sections

function A_popup_Callback(hObject, eventdata, handles)

val = get(hObject,'Value');

switch val

 case 1 
 x = 'Hello'; 
 case 2 
 y = 'goodbye' 
 case 3 
 z = 'thank you' end

function pushbutton1_Callback(hObject, eventdata, handles)




Rom (view profile)


No products are associated with this question.

Contact us