Matlab gui中,我设置了一个下拉菜单,请问如何获取其中内容并显示在文本框中。

2024-12-22 17:25:16
推荐回答(2个)
回答1:

function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Selec;
Selec = get(hObject,'Value');

function pushbutton1_Callback(hObject, eventdata, handles)
global Selec;
Ring = %你的操作
set(handles.text7,'String',Ring);

回答2:

可以在按钮中设置 在按钮的callback里写
S = get(handles.menu,'string');

set(handles.text,'string',S);

类似的概念。