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

guidematlab guipopup

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

Best Answer

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