gui interface and variables

2 vues (au cours des 30 derniers jours)
Patrick Brown
Patrick Brown le 24 Jan 2017
Commenté : Patrick Brown le 24 Jan 2017
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

Réponse acceptée

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);
  1 commentaire
Patrick Brown
Patrick Brown le 24 Jan 2017
it works thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by