hf=figure('Color',[0.8 0.8 0.8],'Position',[100 200 600 450],...
'Name','figure demo ',...
'NumberTitle','off','MenuBar','none');
>> hf=figure('Color',[0.8 0.8 0.8],'Position',[100 200 600 450],...
'Name','figure demo ',...
'NumberTitle','off','MenuBar','none');
>> hf
hf =
1
>> ha=axes('position',[0.1 0.2 0.5 0.5],'box','on')
ha =
0.0011
>> x=[0.5 0.2 0.6 0.8 0.3];y=[0.2 0.3 0.7 0.6 0.5];
>> h1=line(x,y)
h1 =
1.0011
>> retangle('curvance',[0 0])
??? Undefined command/function 'retangle'.
>> pesks(50)
??? Undefined command/function 'pesks'.
>> peaks(50)
z = 3*(1-x).^2.*exp(-(x.^2) - (y+1).^2) ...
- 10*(x/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) ...
- 1/3*exp(-(x+1).^2 - y.^2)
>> hlt=light('position',[1 -1 1],'color','b')
hlt =
5.0011
>> hlt=light('position',[1 -1 1],'color','r')
hlt =
6.0011
>> hlt=light('position',[1 -1 1],'color','m')
hlt =
7.0011
>> hi=image([0.2 5 50 0.4 0.5 9 20 0.2 11])
hi =
8.0011
hme=uimenu(gcf,'label','example')
hme =
151.0012
>> hmesub1=uimenu(hme,'label','grid','callback','grid')
hmesub1 =
152.0015
>> hmesub2=uimenu(hme,'label','view')
hmesub2 =
153.0011
>> hmesub21=uimenu( hmesub2,'label','sin','callback','plot(sin([0:0.1:2*pi]),"r")');
>> hmesub22=uimenu( hmesub2,'label','cos','callback','plot(cos([0:0.1:2*pi]),"b")');
>> hmesub3=uimenu(hme,'label','hold','callback','hold');
hme=uimenu(gcf,'label','example')
>> hmesub1=uimenu(hme,'label','grid','callback','grid')
>> hmesub2=uimenu(hme,'label','view')
_>> hmesub21=uimenu( hmesub2,'label','sin','callback','plot(sin([0:0.1:2*pi]),"r")');
>> hmesub22=uimenu( hmesub2,'label','cos','callback','plot(cos([0:0.1:2*pi]),"b")');
>> hmesub3=uimenu(hme,'label','hold','callback','hold');
hme=uimenu(gcf,'label','example')
>> hmesub1=uimenu(hme,'label','grid','callback','grid')
>> hmesub2=uimenu(hme,'label','view')
>> hmesub21=uimenu( hmesub2,'label','sin','callback','plot(sin([0:0.1:2*pi]))');
>> hmesub22=uimenu( hmesub2,'label','cos','callback','plot(cos([0:0.1:2*pi]))');
>> hmesub3=uimenu(hme,'label','hold','callback','hold');
hhmcsub1=uimenu(hmc,'label','去掉','callback','delete(hme);drawnow');
hhmcsub2=uimenu(hmc,'label','关掉窗口','callback','close');
hme=uimenu(gcf,'label','&color');
9_3:
>> hmesub1=uimenu(hme,'label','&blue','callback','set(gcf,"color","blue")');
>> hmesub2=uimenu(hme,'label','&red','callback','set(gcf,"color","red")');
>> hmesub1=uimenu(hme,'label','&blue','callback','hh');
>> hmesub2=uimenu(hme,'label','&red','callback','rr');
设置快界彩旦:
hmek=uimenu(gcf,'label','&color');
>> hmesub1=uimenu(hmek,'label','&blue','callback','hh');
>> hmesub2=uimenu(hmek,'label','&red','callback','rr');
菜单的外观设置:
set(gcf,'menubar','none')
>> set(gcf,'menubar','figure')
9——4位置和分隔线:
figure
>> hmo=uimenu('label','option','position',4);
>> hmesub1=uimenu(hmek,'label','&blue','callback','hh');
hmesub2=uimenu(hmek,'label','&red','callback','rr');
>> hmosub1=uimenu(hmo,'label','grid on','callback','grid on');
>> hmosub2=uimenu(hmo,'label','grid off','callback','grid off');
>> hmosub3=uimenu(hmo,'label','box on','callback','box on');
>> hmosub3=uimenu(hmo,'label','box on','callback','box on','separator','on');
>> hmosub4=uimenu(hmo,'label','box off','callback','box off');
>> hmosub5=uimenu(hmo,'label','figure color','separator','on');
>> hmosub51=uimenu(hmosub5,'label','red','foregroundcolor','r',...
'callback','rr');
>> hmosub52=uimenu(hmosub5,'label','white','callback','ww');
标志checked:
figure
hmoo=uimenu('label','option');
hmoosub1=uimenu(hmoo,'label','grid on','callback','checked');
hmoosub2=uimenu(hmoo,'label','grid off','callback','checked2');
调用函数:
grid off
set(hmoosub2,'checked','on');
set(hmoosub1,'checked','off');。。。。。。。。。为checked2
grid on
set(hmoosub1,'checked','on');
set(hmoosub2,'checked','off');............. checked
为线条设置快捷菜单:
t=(-2*pi:pi/60:2*pi)+eps;
>> y=sin(t)./t;
>> hline=plot(t,y);
>> cm=uicontextmenu;
>> uimenu(cm,'label','red','callback','cmr');
>> uimenu(cm,'label','blue','callback','cmb');
>> uimenu(cm,'label','green','callback','cmg');
>> set(hline,'uicontextmenu',cm)
set(hline,'color','g')。。。。。。。。。设置绿色函数
界面
hf=figure('Position',[400 400 650 450],...
'Name','uicontrol' ,'NumberTitle','off')
hbsin=uicontrol(hf,'Style','pushbutton' ,...
'Position',[50 140 100 30],...
'String','plot sin(x)',...
'callback','hhh')