gui interface and variables

1 次查看(过去 30 天)
hi I am developing and user interface I want to select by means of a pop menu the value of a variable function popupmenu1_Callback(velocity, eventdata, handles) vel=get(velocity,'Value')
how I can do it?. I want that the value of the string in the pop menu becomes the value of the variable vel and besides, I want this variable in the workspace to do more operations
in the two lines written vel gets the value of the position and is not available in the workspace
thanks

采纳的回答

Jorge Mario Guerra González
The structure to use popupmenu is something like this
function popupmenu1_Callback(hObject, eventdata, handles)
option=get(handles.popupmenu1,'value'); %Now Vel has the number of option
c=get(handles.popupmenu1,'String');
your_string=c{option} %your_string has the string value
assignin ('base','your_string',your_string) %sends it to workspace
guidata(hObject, handles);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by