⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmenus.m

📁 对于精通掌握matlab非常有用的资料
💻 M
字号:
function mmenus()%MMENUS Simple menu example.% MMENUS uses waitforbuttonpress and gco in the callback strings%  to let the user make a menu selection and then select an object %  by clicking on it with the mouse. The callback strings then use %  the set function to apply the property value to the selected object.% B.R. Littlefield, University of Maine, Orono ME 04469% 5/30/95% Copyright (c) 1996 Prentice Hall, Inc.Hm_line   = uimenu(gcf,'label','Line');Hm_lstyle = uimenu(Hm_line,'label','Line Style');Hm_lwidth = uimenu(Hm_line,'label','Line Width');Hm_lcolor = uimenu(Hm_line,'label','Line Color');uimenu(Hm_lstyle,'Label','Solid',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''LineStyle'',''-''),',...        'end']);uimenu(Hm_lstyle,'Label','Dotted',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''LineStyle'','':''),',...        'end']);uimenu(Hm_lstyle,'Label','Dashed',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''LineStyle'',''--''),',...        'end']);uimenu(Hm_lstyle,'Label','DashDot',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''LineStyle'',''-.''),',...        'end']);uimenu(Hm_lwidth,'Label','Default',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''LineWidth'',0.5),',...        'end']);uimenu(Hm_lwidth,'Label','Thick',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''LineWidth'',2.0),',...        'end']);uimenu(Hm_lwidth,'Label','Thicker',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''LineWidth'',3.0),',...        'end']);uimenu(Hm_lwidth,'Label','Thickest',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''LineWidth'',4.0),',...        'end']);uimenu(Hm_lcolor,'Label','Yellow',...    'BackgroundColor','y',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''Color'',''y''),',...        'end']);uimenu(Hm_lcolor,'Label','Magenta',...    'BackgroundColor','m','ForegroundColor','w',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''Color'',''m''),',...        'end']);uimenu(Hm_lcolor,'Label','Cyan',...    'BackgroundColor','c',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''Color'',''c''),',...        'end']);uimenu(Hm_lcolor,'Label','Red',...    'BackgroundColor','r','ForegroundColor','w',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''Color'',''r''),',...        'end']);uimenu(Hm_lcolor,'Label','Green',...    'BackgroundColor','g',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''Color'',''g''),',...        'end']);uimenu(Hm_lcolor,'Label','Blue',...    'BackgroundColor','b','ForegroundColor','w',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''Color'',''b''),',...        'end']);uimenu(Hm_lcolor,'Label','White',...    'BackgroundColor','w',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''Color'',''w''),',...        'end']);uimenu(Hm_lcolor,'Label','Black',...    'BackgroundColor','k','ForegroundColor','w',...    'CallBack',['waitforbuttonpress;',...        'if get(gco,''Type'') == ''line'',',...            'set(gco,''Color'',''k''),',...        'end']);Hm_cmap = uimenu(gcf,'Label','Color Map');uimenu(Hm_cmap,'Label','Lighter','CallBack','brighten(.3)');uimenu(Hm_cmap,'Label','Darker','CallBack','brighten(-.3)');uimenu(Hm_cmap,'Label','Default','CallBack','colormap(''default'')');uimenu(Hm_cmap,'Label','Gray','CallBack','colormap(gray)');uimenu(Hm_cmap,'Label','Hot','CallBack','colormap(hot)');uimenu(Hm_cmap,'Label','Cool','CallBack','colormap(cool)');uimenu(Hm_cmap,'Label','Bone','CallBack','colormap(bone)');uimenu(Hm_cmap,'Label','Copper','CallBack','colormap(copper)');uimenu(Hm_cmap,'Label','Pink','CallBack','colormap(pink)');uimenu(Hm_cmap,'Label','Prism','CallBack','colormap(prism)');uimenu(Hm_cmap,'Label','Jet','CallBack','colormap(jet)');uimenu(Hm_cmap,'Label','Flag','CallBack','colormap(flag)');uimenu(Hm_cmap,'Label','HSV','CallBack','colormap(hsv)');Hm_quit = uimenu(gcf,'Label','Quit');uimenu(Hm_quit,'Label','Close Figure','CallBack','close; return');uimenu(Hm_quit,'Label','Remove Menus',...    'CallBack',[...	    'delete(findobj(gcf,''Type'',''uimenu'',''Parent'',gcf)),',...		'drawnow']);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -