📄 fig2eps.m
字号:
function fig2eps(repfig,figure_handle)% Export figure for use in reports% Written by: E. R.: March 4, 2003% Last updated: April 14, 2004: Use also workflow name, global variable % WF.name (if it exists)%% fig2eps(repfig,figure_handle)% INPUT% repfig unique figure number for report (required)% figure_handle figure number % Default: figure_handle=gcf%% global variable S4M.eps_directory Directory name in directory with papers% e.g. S4M.eps_directory='Papers\Euclid_wavelet_length'% The full path is "fullfile(S4M.report_path,S4M.eps_directory)"global S4M WFif nargin == 0 alert(' Figure number in report is required for an EPS file to be saved') returnendif nargin == 1 figure_handle=gcf;endfigure(figure_handle)pos=get(figure_handle,'PaperOrientation');if strcmpi(pos,'portrait') bool=0; set(figure_handle,'PaperPosition',[0.8 0.5 4.4 5.5]);else set(figure_handle,'PaperPosition',[0.8 0.5 10 5.5]); set(figure_handle,'PaperOrientation','portrait') bool=1;endset(gcf, 'InvertHardcopy', S4M.invert_hardcopy)name1='';if isfield(S4M,'eps_directory') & ~isempty(S4M.eps_directory) if isfield(WF,'name') & ~isempty(WF.name) % Prepend workflow name followed by "." name1=[WF.name,'.']; end try filepath=fullfile(S4M.eps_directory,[name1,S4M.script,'_',num2str(repfig),'.eps']);% print('-depsc2',filepath) advexpfig(figure_handle,filepath,'-depsc2','w',20);% disp('here') catch try filepath=fullfile(S4M.report_path,S4M.eps_directory,[name1,S4M.script,'_',num2str(repfig),'.eps']); print('-depsc2',filepath) catch alert(['File "',filepath,'" could not be created. EPS file has not been saved.']) return end end else alert(' Field "eps_directory" of global variables "S4M" is empty.'); if S4M.interactive S4M.eps_directory=uigetfolder_standalone('Directory for EPS files', 'C:\'); if isempty(S4M.eps_directory) return end filepath=fullfile(S4M.eps_directory,[name1,S4M.script,'_',num2str(repfig),'.eps']); print('-depsc2',filepath) else disp(' Figure not saved.') return endendif bool set(figure_handle,'PaperOrientation','landscape')end[directory,filename,ext]=fileparts(filepath);if S4M.interactive msgdlg(['Figure saved in file "',filename,ext,'" in directory "',directory,'" as an Encapsulated PostScript file'])enddisp(['Figure saved in file "',filename,ext,'" in directory "',directory,'" as an Encapsulated PostScript file'])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -