Matlab GUI编程求教
发布网友
发布时间:2022-05-14 04:27
我来回答
共1个回答
热心网友
时间:2024-02-24 00:20
function test(input)
% if nargin == 0
% inp
% end
fh = figure('units','pixels','position',[380 200 560 600]);
%----------
ha = uicontrol('style','text','position',[115 450 80 25],...
'string','男生星座','FontSize',14,'units','pixels');
hb = uicontrol('style','text','position',[355 450 80 25],'string','女生星座','FontSize',14,'units','pixels');
hc = uicontrol(gcf,'style','popupmenu','position',[125 400 60 30],...
'string', '白羊座|金牛座|双子座|巨蟹座|狮子座|*座|天平座|天蝎座|射手座|魔蝎座|水瓶座|双鱼座');
a = get(hc,'Value')
hd = uicontrol(gcf,'style','popupmenu','position',[365 400 60 30],...
'string', '白羊座|金牛座|双子座|巨蟹座|狮子座|*座|天平座|天蝎座|射手座|魔蝎座|水瓶座|双鱼座');
hg = uicontrol('style','text','position',[0 0 560 330]);
hf = uicontrol('Style','pushbutton','Position', [230 350 100 30],'String','配对','callback',{@button1_callback,hg,hc,hd});
function button1_callback(src,eventdata,hg,hc,hd)
set(hg,'String',{'Hello world';get(hc,'Value'); get(hd,'Value')});
end
end