Info

This question is closed. Reopen it to edit or answer.

How to use variable of another function with a function? switch-case. Matlab Gui

1 view (last 30 days)
I want to call a variable in a popupmenu from a button. I mean, popup value will only show the current status and when I press the button it will operate according to the popup menu status. Here is my code, i get "Undefined function or variable 'popupmenu4value" error when i press the button.
function pushbutton1_Callback(hObject, eventdata, handles)
switch popupmenu4value
case 'A'
%function of A
case 'B'
%function of B
function popupmenu4_Callback(hObject, eventdata, handles)
contents = get(handles.popupmenu4,'String');
popupmenu4value = contents{get(handles.popupmenu4,'Value')};
I found axesMenuToolbar in gui examples but it is written in older verison and i can't use it. what i want is exactly this "axesMenuToolbar" help gui. thanks in advance..

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!