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

조회 수: 3 (최근 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에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by