GUI的设计有两种方法 1. 依托GUI向导进行设计
2. 直接编写程序进行设计
本Blog只介绍第二种用程序进行设计
h0=figure('menubar','none','toolbar','none','name','myfirstGUI');
h1=uimenu(h0,'label','Draw');
h11=uimenu(h1,'label','Membrane','callback','membrane');
h12=uimenu(h1,'label','Peaks','callback','peaks');
h13=uimenu(h1,'label','Sinc','callback',...
['[x,y]=meshgrid(-5:0.5:5);','r=sqrt(x.^2+y.^2)+eps;',...
'z=sin(r)./r;','surf(z);']);
h2=uimenu(h0,'label','ColorMap');
h22(1)=uimenu(h2,'label','Hot',...
'callback',...
['set(h22,''checked'',''off'');',...
'set(h22(1),''checked'',''on'');','colormap(hot);']);
h22(2)=uimenu(h2,'label','Cool',...
'callback',...
['set(h22,''checked'',''off'');',...
'set(h22(2),''checked'',''on'');','colormap(cool);']);
h22(3)=uimenu(h2,'label','Spring',...
'callback',...
['set(h22,''checked'',''off'');',...
'set(h22(3),''checked'',''on'');','colormap(Spring);']);
阅读(1018) | 评论(0) | 转发(0) |