Screen=get(0,'screensize');
W=Screen(3);H=Screen(4);
figure('color',[1,1,1],'posi
tion',[0.2*H,0.2*H,0.5*W,0.3*W],...
'Name','图形演示系统','NumberTitle','off','menubar','none');
hplot=uimenu(gcf,'Label','&Plot');
uimenu(hplot,'label','Sine Wave','callback',...
['t=-pi:pi/20:pi;',...
'plot(t,sin(t));',...
'set(hgon,"Enable","on");',...
'set(hgoff,"Enable","on");',...
'set(hbon,"Enable","on");',...
'set(hboff,"Enable","on");']);
uimenu(hplot,'label','Cosine Wave','callback',...
['t=-pi:pi/20:pi;',...
'plot(t,cos(t));',...
'set(hgon,"enable","on");',...
'set(hgoff,"enable","on");',...
'set(hbon,"enable","on");',...
'set(hboff,"enable","on");']);
hoption=uimenu(gcf,'Label','&Option');
hgon=uimenu(hoption,'Label','&Grid on','callback','grid on','enable','off');
hgoff=uimenu(hoption,'Label','&Grid off','callback','grid off','enable','off');
hbon=uimenu(hoption,'Label','&Box on','separator','on','callback','box on','enable','off');
hboff=uimenu(hoption,'Label','&Box off','callback','box off','enable','off');
hwincor=uimenu(hoption,'Label','&Window Color','separator','on');
uimenu(hwincor,'Label','&Red','accelerator','r','callback','set(gcf,"color","r");');
uimenu(hwincor,'Label','&Bed','accelerator','b','callback','set(gcf,"color","b");');
uimenu(hwincor,'label','&Yellow','accelerator','y','callback','set(gcf,"color","y");');
uimenu(hwincor,'Label','&White','accelerator','w','callback','set(gcf,"color","w");');
uimenu(gcf,'Label','&Quit','callback','close(gcf)');
这段代码运行后达不到预期的效果,在
matlab 2012b上运行的
一周热门 更多>