MATLAB中的popupmenu如何实现
2013-05-19
展开全部
好像可以,我给你一个例子,不过是实现图像的选取功能,你可以在编辑窗口中运行,但是实现了功能
h0=figure('toolbar','none',...
'position',[200 150 450 250],...
'name','实例36');
x=0:0.5:2*pi;
y=sin(x);
h=plot(x,y);
grid on
jb=uicontrol(gcf,'style','popupmenu',...
'string',...
'sin(x)|cos(x)|sin(x)+cos(x)|exp(-sin(x))',...
'position',[250 20 50 20]);
set(jb,'value',1)
huidiao=[...
'v=get(jb,''value'');,',...
'switch v,',...
'case 1,',...
'delete(h),',...
'y=sin(x);,',...
'h=plot(x,y);,',...
'grid on,',...
'case 2,',...
'delete(h),',...
'y=cos(x);,',...
'h=plot(x,y);,',...
'grid on,',...
'case 3,',...
'delete(h),',...
'y=sin(x)+cos(x);,',...
'h=plot(x,y);,',...
'grid on,',...
'case 4,',...
'delete(h),',...
'y=exp(-sin(x));,',...
'h=plot(x,y);,',...
'grid on,',...
'end'];
set(jb,'callback',huidiao)
set(gca,'position',[0.2 0.2 0.6 0.6])
title('弹出式菜单的使用')
h0=figure('toolbar','none',...
'position',[200 150 450 250],...
'name','实例36');
x=0:0.5:2*pi;
y=sin(x);
h=plot(x,y);
grid on
jb=uicontrol(gcf,'style','popupmenu',...
'string',...
'sin(x)|cos(x)|sin(x)+cos(x)|exp(-sin(x))',...
'position',[250 20 50 20]);
set(jb,'value',1)
huidiao=[...
'v=get(jb,''value'');,',...
'switch v,',...
'case 1,',...
'delete(h),',...
'y=sin(x);,',...
'h=plot(x,y);,',...
'grid on,',...
'case 2,',...
'delete(h),',...
'y=cos(x);,',...
'h=plot(x,y);,',...
'grid on,',...
'case 3,',...
'delete(h),',...
'y=sin(x)+cos(x);,',...
'h=plot(x,y);,',...
'grid on,',...
'case 4,',...
'delete(h),',...
'y=exp(-sin(x));,',...
'h=plot(x,y);,',...
'grid on,',...
'end'];
set(jb,'callback',huidiao)
set(gca,'position',[0.2 0.2 0.6 0.6])
title('弹出式菜单的使用')
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
2013-05-19
展开全部
首付v
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询