Linking a pushbutton to two dropdown menus in GUIDE
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    vedesh Mohit
 el 27 de En. de 2020
  
    
    
    
    
    Respondida: Geoff Hayes
      
      
 el 27 de En. de 2020
            I have a pushbutton that is required to draw a line based on the options that the user selects from the two dropdown menus. How can this be done in GUIDE?
0 comentarios
Respuesta aceptada
  Geoff Hayes
      
      
 el 27 de En. de 2020
        vedesh - in the pushbutton callback, you would use the handles structure to get the selections from the two dropdown menus. Your code could look something like the following
function pushbutton1_Callback(hObject, eventdata, handles) 
% get the selection from the first drop down menu
popup1List = get(handles.popup1,'String'); % get the list of items of popup1
popup1Index = get(handles.popup1,'Value'); % get the index of the selected item of popup1
popup1Value = popup1List{idx};             % get the value of the selected item of popup1
% get the selection from the second drop down menu
popup2List = get(handles.popup2,'String'); % get the list of items of popup2
popup2Index = get(handles.popup2,'Value'); % get the index of the selected item of popup2
popup2Value = popup2List{idx};             % get the value of the selected item of popup2
% note that popup1Value and popup2Value are strings so you may need to convert to numbers is
% applicable
% do whatever work you need to and draw line on axes
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!