📄 fig2pp.m
字号:
function fig2pp(figno,reverse)
% Export figure for use in PowerPoint
% Written by: E. R.: January 20, 2003
% Last updated: July 6, 2005: Check for empty "figno": set it to "gcf"
%
% fig2pp(figno,reverse)
% INPUT
% figno figure number
% Default (if not given or empty): figno=gcf
% reverse Reverse the figure background and axis colors and adjust graphs
% (see "whitebg")
% Default: reverse=logical(1);
% S4M.invert_hardcopy must be set to 'off' to have an effect
% (See figure property 'InvertHardcopy')
global S4M
persistent aux_figno
% directory=fullfile('C:\Documents and Settings',getenv('USERNAME'),'My Documents','My Pictures');
directory=S4M.pp_directory;
if nargin == 0
figno=gcf;
reverse=logical(1);
elseif nargin == 1
reverse=logical(1);
else
if isempty(figno)
figno=gcf;
end
end
if isempty(aux_figno)
aux_figno=1;
else
aux_figno=aux_figno+1;
end
figure(figno)
pos=get(figno,'PaperOrientation');
if S4M.matlab_version < 7
if strcmpi(pos,'portrait')
set(figno,'PaperPosition',[0.8 0.5 4.4 5.5]);
else
set(figno,'PaperPosition',[0.8 0.5 8.5 5.5]);
end
else
% yy=4
if strcmpi(pos,'portrait')
set(figno,'PaperPosition',[0.8 0.5 4.4, 5.5]);
else
set(figno,'PaperPosition',[0.8 0.5 8.7, 6.0]);
% xx=5.2
% set(figno,'PaperPosition',[0.8, 0.5, 8.5, 5.2]);
end
end
if isempty(S4M.script)
filename=['Figure_',num2str(figno),'_x',num2str(aux_figno),'.emf'];
else
filename=[S4M.script,'_',num2str(figno),'_x',num2str(aux_figno),'.emf'];
end
filepath=fullfile(directory,filename);
if reverse
whitebg(figno) % Change background to complementary colors
end
set(figno,'InvertHardcopy',S4M.invert_hardcopy);
try
print('-dmeta',filepath)
drawnow % Added to prevent the figure from moving above the screen in Matlab 7
catch
[filepath,ierr]=get_filename4w('.emf');
if ierr
whitebg(figno) % Change background to complementary colors
return
end
[directory,name,ext]=fileparts(filepath);
filename=[name,ext];
print('-dmeta',filepath)
drawnow % Added to prevent the figure from moving above the screen in Matlab 7
end
if reverse
whitebg(figno) % Change background to complementary colors
end
if S4M.interactive
msgdlg(['Figure saved in file "',filename,'" in directory "',directory,'" as a Windows Enhanced Meta File.'])
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -