lxq 发表于 2006-11-16 12:57

UIMENU菜单的应用!!

h0=figure('toolbar','none', 'position',, 'name','实例4');
h1=uimenu(gcf,'label','函数');
h11=uimenu(h1,'label','轮廓图','callback', ...
   ['set(h31,''checked'',''on''), set(h32,''checked'',''off''), =peaks; contour3(x,y,z,30)']);
h12=uimenu(h1,'label','高斯分布','callback', ...
   ['set(h31,''checked'',''on''), set(h32,''checked'',''off''), mesh(peaks); axis tight']);
h13=uimenu(h1,'label','Sinc函数','callback', ...
    ['set(h31,''checked'',''on''), set(h32,''checked'',''off''),',...
      '=meshgrid(-8:0.5:8); r=sqrt(x.^2+y.^2)+eps; z=sin(r)./r; mesh(x,y,z)']);
h2=uimenu(gcf,'label','色彩');
hl2(1)=uimenu(h2,'label','Default', 'checked','on', 'callback',...
    [ 'set(hl2,''checked'',''off''), set(hl2(1),''checked'',''on''), colormap(''default'')']);
hl2(2)=uimenu(h2,'label','spring','callback',...
    [ 'set(hl2,''checked'',''off''), set(hl2(2),''checked'',''on''), colormap(spring)']);
hl2(3)=uimenu(h2,'label','Summer','callback',...
    [ 'set(hl2,''checked'',''off''), set(hl2(3),''checked'',''on''), colormap(summer)']);
hl2(4)=uimenu(h2,'label','Autumn','callback',...
    ['set(hl2,''checked'',''off''), set(hl2(4),''checked'',''on''), colormap(autumn)']);
hl2(5)=uimenu(h2,'label','Winter','callback',...
    [ 'set(hl2,''checked'',''off''), set(hl2(5),''checked'',''on''), colormap(winter)']);
h3=uimenu(gcf,'label','坐标选项');
h31=uimenu(h3,'label','Axis on','callback',...
    [ 'axis on, set(h31,''checked'',''on''), set(h32,''checked'',''off'')']);
h32=uimenu(h3,'label','Axis off','callback',...
    [ 'axis off, set(h32,''checked'',''on''), set(h31,''checked'',''off'')']);

[ 本帖最后由 ChaChing 于 2009-12-28 15:21 编辑 ]

wangyongq246 发表于 2006-11-16 16:23

需要看什么样的书,才能写出这样的程序呢!?

xjtu211 发表于 2006-11-16 16:35

原帖由 wangyongq246 于 2006-11-16 16:23 发表
需要看什么样的书,才能写出这样的程序呢!?
这是gui方面的,推荐
《精通GUI图形界面编程》 施晓红 周佳 著 北大出版社

suffer 发表于 2006-11-20 08:25

这个程序有一个问题

就是在画图之前先选axis off是无效的

HolySaint 发表于 2006-11-25 12:26

??? Attempt to execute SCRIPT uimenu as a function.

Error in ==> uimenu at 4
h1=uimenu(gcf,'label','函数');

这是什么错误
怎么改正?

suffer 发表于 2006-11-29 10:00

上述程序没有什么问题,不知道你是如何操作的?
从错误来看,应该是你的matlab存在一个自定义的uimenu函数
用which uimenu -all检查一下,是否有多余的,改名

[ 本帖最后由 ChaChing 于 2009-12-28 15:04 编辑 ]
页: [1]
查看完整版本: UIMENU菜单的应用!!