| 查看: 1076 | 回复: 1 | |||
[求助]
MATLAB gui 下拉菜单的实现
|
|
求助! 现在有三个单选按钮,想改成一个下拉菜单实现。 单选按钮部分的程序: Rs1=uicontrol(FigureHandle,'Style','radio','unit','pixels',... 'Position',[TextXP(2),TextYP(2),140,TextHeight],... 'String','situation1', 'Value',InputData.Type(1),'Tag','Type1',... 'CallBack',['set(findobj(''Tag'',''Type1''),''Value'',1);'... 'set(findobj(''Tag'',''Type2''),''Value'',0);'... 'set(findobj(''Tag'',''Type3''),''Value'',0);'],... 'fontsize',12,'BackgroundColor', BackColor{2}); Rs2=uicontrol(FigureHandle,'Style','radio','unit','pixels',... 'Position',[TextXP(2),TextYP(2),140,TextHeight],... 'String','situation2', 'Value',InputData.Type(2),'Tag','Type2',... 'CallBack',['set(findobj(''Tag'',''Type1''),''Value'',1);'... 'set(findobj(''Tag'',''Type2''),''Value'',0);'... 'set(findobj(''Tag'',''Type3''),''Value'',0);'],... 'fontsize',12,'BackgroundColor', BackColor{2}); Rs2=...(类似) 改成: Rs1=uicontrol(FigureHandle,'Style','popup','unit','pixels',... 'Position',[TextXP(2),TextYP(2),100,TextHeight],... 'String','situation2|situation2|situation3',... 'CallBack',@SetTag,'fontsize',11,'BackgroundColor', BackColor{3}); 定义的SetTag函数: function SetTag(h,event,data) % Called when user activates popup menu val = get(h,'Value'); if val==1 set(findobj('Tag','Type1'),'Value',1); set(findobj('Tag','Type2'),'Value',0); set(findobj('Tag','Type3'),'Value',0); elseif val==2 set(findobj('Tag','Type1'),'Value',0); set(findobj('Tag','Type2'),'Value',1); set(findobj('Tag','Type3'),'Value',0); elseif val==3 set(findobj('Tag','Type1'),'Value',0); set(findobj('Tag','Type2'),'Value',0); set(findobj('Tag','Type3'),'Value',1); end 现在能显示下拉菜单,也可以选择,但是Value部分赋值给InputData.Type该怎么弄,不会写啊,求教! |
» 猜你喜欢
面上没中,邀请各位路过的虫友分析一下分数
已经有13人回复
售SCI一区T0P文章,我:8.O.55.1.O54,科目全,可伽急
已经有8人回复
两块石头
已经有8人回复
初秋的晨风
已经有6人回复
学科评审组评审是指会评吗?
已经有9人回复
售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急
已经有14人回复
广西大学-广州大学招聘博士后 欢迎广大优秀人才!!!
已经有7人回复
科研人应该花精力去思考如何解决问题,而不是去凝练问题
已经有17人回复
Ei源刊怎么投
已经有4人回复
哈尔滨工业大学韩晓军教授课题组招收2027年硕士推免生及博士研究生
已经有3人回复
2楼2015-09-17 12:45:23










回复此楼