MATLAB: How to pass options from popupmenu to another callback function

callback functionguiguidepopupmenu

Hi all! I'm programming a GUI. I have a popup menu that enables to display differents signals depending on the option selected. In the callback function of popup menu I've write this code:
% Determine the selected data set.
str = get(source, 'String');
val = get(source,'Value');
% Set current data to the selected data set.
switch str{val}
case 'Delta' % User selects Delta.
current_data = delta;
case 'Theta' % User selects Theta.
current_data = theta;
case 'Alpha' % User selects Alpha.
current_data = alpha;
case 'Beta' % User selects Beta.
current_data = beta;
case 'Gamma' % User selects Gamma.
current_data = gamma;
end
Now I've to pass the option selected to a pushbutton's callback function that generates plot when pushed by users. How can I do this? It would very helpful for me to resolve this problem. Thanks in advance.
[EDITED, code formatted, Jan]

Best Answer

You don't need to pass the selected option when the selection is made in the popup. The easiest is simply read out the popup value when you run the callback of the button.
the callback of the button should look like this:
choise = get(handles.popupmenuband,'Value'); %get selected band
switch choise
case 1
% plot alpha
case 2
%plot beta
case 3
%plot gamma
%(etcetera)
end