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

📄 figure_export_menu.m

📁 实现地震勘探中
💻 M
字号:
function menu_handle=figure_export_menu(figure_handle)% Creates a menu button on the figure with handle "figure_handle" (or% the current figure) that allows one to save the figure as a "emf" (Enhanced% Windows Meta File) for PowerPoint or "eps" (Encapsulated PostScript) for % LaTeX, or as a JPEG file; does nothing if the menu button already exists.%% Written by: E. R.: November 16, 2003% Last updated: August 31, 2007: check if figure export button already exists%%         menu_handle=figure_export_menu(figure_handle)% INPUT% figure_handle  handle of the figure to which to attach the menu button%         Default: gcf%% EXAMPLE%         figure%         plot(1:11)%         figure_export_menu            persistent fig_noif nargin == 0   figure_handle=gcf;endif isempty(fig_no)   fig_no=1;else   fig_no=fig_no+1;end%       Check is a figure-export menu button already exists and return if it doesif ~isempty(findobj(figure_handle,'tag','figure_export_menu'))   disp('Figure-export menu button exists.')   menu_handle=[];   returnend%	Create menu bottonmenu_handle=uimenu(figure_handle,'Label','Save plot','ForegroundColor','b','Tag','figure_export_menu');%	Create submenu itemsuimenu(menu_handle,'Label','EMF (for PowerPoint)', ...          'CallBack',{@g_fig2pp,figure_handle,0});uimenu(menu_handle,'Label','JPEG', ...          'CallBack',{@g_fig2jpg,figure_handle,0});uimenu(menu_handle,'Label','EPS (for LaTeX)', ...          'CallBack',{@g_fig2eps,fig_no,figure_handle});if nargout == 0   clear menu_handle end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function g_fig2pp(hObject,eventdata,figure_handle,reverse) %#ok first two arguments are place holders% Version of "fig2pp" to be called by a menu callback% Written by: E. R.: November 16, 2003% Last updated: May 8, 2004: made subfunction%%         g_fig2pp(hObject,eventdata,figure_handle,reverse)% INPUT% figure_handle  handle of the figure to which to attach the menu button% reverse    Reverse the figure background and axis colors and adjust graphs%            (see "whitebg")%            S4M.invert_hardcopy must be set to 'off' to have an effect%           (See figure property 'InvertHardcopy')fig2pp(figure_handle,reverse);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function g_fig2jpg(hObject,eventdata,figure_handle,reverse) %#ok first two arguments are place holders% Version of "fig2pp" to be called by a menu callback% Written by: E. R.: November 16, 2003% Last updated: May 8, 2004: made subfunction%%         g_fig2pp(hObject,eventdata,figure_handle,reverse)% INPUT% figure_handle  handle of the figure to which to attach the menu button% reverse    Reverse the figure background and axis colors and adjust graphs%            (see "whitebg")%            S4M.invert_hardcopy must be set to 'off' to have an effect%           (See figure property 'InvertHardcopy')fig2jpg(figure_handle,reverse);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function g_fig2eps(hObject,eventdata,repfig,figno) %#ok first two arguments are place holders% Export figure for use in LaTeX documents% Written by: E. R.: March 4, 2003% Last updated: March 19, 2004: use fig2eps which uses report %              directory in "S4M.eps_directory"%%         g_fig2eps(hObject,eventdata,repfig,figno)% INPUT% repfig  unique figure number for report (required)% figno   number of figure to export%         Default: figno=gcfif ischar(repfig)   repfig=str2double(repfig);endif nargin == 0   error(' Figure number in report is required')endif nargin == 1   figno=gcf;endfig2eps(repfig,figno)

⌨️ 快捷键说明

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