弹出菜单的使用!!
h0=figure('toolbar','none',...'position',,...
'name','实例36');
x=0:0.5:2*pi;
y=sin(x);
h=plot(x,y);
grid on
hm=uicontrol(gcf,'style','popupmenu',...
'string',...
'sin(x)|cos(x)|sin(x)+cos(x)|exp(-sin(x))',...
'position',);
set(hm,'value',1)
huidiao=[...
'v=get(hm,''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(hm,'callback',huidiao)
set(gca,'position',)
title('弹出式菜单的使用')
[ 本帖最后由 suffer 于 2006-11-20 08:29 编辑 ] 呵呵,早就想说声谢谢了,就是看了你这个例子后,在GUI编程上获得大的启发.
支持下,以后多上传下这样的例子!
[ 本帖最后由 无水1324 于 2007-8-16 20:01 编辑 ] 确实不错,不过弹出式菜单的横坐标太小了点,函数名看不全,调大一点就好了
页:
[1]