Pop-Up menu help

조회 수: 18 (최근 30일)
vlad vladut
vlad vladut 2015년 2월 28일
댓글: vlad vladut 2015년 3월 1일
I have 5 pop-up menus with different Strings( for example 10 20 30)...What is the code for a PushBotton to get me the number i choose in each pop-up menu and do me a simple operation...for example to mupltiply...I dont know if u understand what i mean....i select in each pop-up different numbers and then it calculates me and if i change a pop-up menu to a different number or any of them after i press calculate to do it right

채택된 답변

Geoff Hayes
Geoff Hayes 2015년 3월 1일
편집: Geoff Hayes 2015년 3월 1일
Vlad - assuming that you are using GUIDE to create your GUI, suppose your five popup menus are named popupmenu1, popupmenu2,..., popupmenu5. If we assume that only numeric data has populated each of your popup menus, then the callback for your push button would look something like
function pushbutton1_Callback(hObject, eventdata, handles)
% get the list of items in the first popup menu
menu1List = get(handles.popupmenu1,'String');
% get the selected item in the first popup menu and convert to a number
menu1Item = str2num(menu1List{get(handles.popupmenu1,'Value')});
You would then just repeat the above code for the remaining four popup menus and do whatever operation you need against them.
  댓글 수: 1
vlad vladut
vlad vladut 2015년 3월 1일
Perfect!!!! ty very much!!! works nicely

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by