How to read popup menu string and use it in another button function? MATLAB GUI

5 次查看(过去 30 天)
I have a problem with reading a popup menu string and using it in a switch-case function in another button. My popup menu shouldn't have any function but indicating the value. But the button should know the value of popup menu and switch the case according to it. Thanks in advance.
My code:
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')};

采纳的回答

Walter Roberson
Walter Roberson 2013-8-23
contents = get(handles.popupmenu4,'String');
popupmenu4value = contents{get(handles.popupmenu4,'Value')};
  4 个评论
Image Analyst
Image Analyst 2013-8-30
Mark as "Accepted" then, so people like me don't have to waste time and come in and read all the way to the bottom only to discover it's been solved already.

请先登录,再进行评论。

更多回答(1 个)

wassim sam
wassim sam 2019-3-27
3ib 3lik

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by