Clear Filters
Clear Filters

gui interface and variables

1 view (last 30 days)
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

Accepted Answer

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);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!