How to use a popup menu to link a number in MATLAB GUIDE?

1 view (last 30 days)
Hello, I have a question about popup menu. Right now, I want the user to choose the wheel size in the popup menu. So the there are few choices in the menu such as 20*8-11, 21*8-10 ..... However, I want use the wheel size to do the later on calculation in a sub function.It is impossible to do calculation with something like a string (eg.20*8-11). So how do I give the out put as Wheel_Size=20; Rim_Size=11, if the user select the 20*8-11 in the popup menu?
Thanks a lot
Kevin Tran

Accepted Answer

Image Analyst
Image Analyst on 22 Nov 2015
You can put those strings into the popup with code, or, if you know that they will be the same on every run, then just edit the string property of the popup in GUIDE. Then just get the value and switch or use an if:
selectedItem = get(handles.popup1, 'Value');
switch selectedItem
case 1
% 20*8-11 - do something....
case 2
% 21*8-10
end
  1 Comment
Kevin Tran
Kevin Tran on 26 Nov 2015
Thank you.
I solved this issue by myself, but I exactly did what you wrote there, thanks!
And Btw, do you know anything can make the GUI looks more beautiful? or something surprise in a good way. cuz this is a part of project gonna give to prof and its among around 15 groups.... Thanks again!

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps 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!