About how to add two popmenu values
2 views (last 30 days)
Show older comments
Hello, i'm begginer in matlab. So what i want to do is to add two pop upmenu's values. For example if i choose popupmenu1 with value 2 and popupmenu2 with value 3 , i get answer 5. If I stay with the same value in popupmenu1 and click on popupmenu2 with value 6 , I get 8 and etc. I think you get what i need. P.S i'm working with GUI
0 Comments
Answers (1)
Image Analyst
on 27 May 2013
Are the numbers in the popup the same as the index value, like 1,2,3,4, or are they different, like 2,4,6,8, etc.?
Have each popup callback call a custom function you write called "AddPopups" and it would be like this (untested)
function result = AddPopups(handles)
popupValue1 = get(handles.popup1, 'Value');
popupValue2 = get(handles.popup2, 'Value');
contents1 = get(handles.popup1,'String')
contents2 = get(handles.popup2,'String')
number1 = str2double(contents1{popupValue1});
number2 = str2double(contents2{popupValue2});
result = number1 + number2;
See Also
Categories
Find more on MATLAB Report Generator in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!