📄 save_a_plot2_audiological.m
字号:
function save_a_plot2_audiological(a, filename, flag2)
% % save_a_plot2_audiological: Saves current figure to specified image type.
% %
% % Syntax: save_a_plot2_audiological(a, filename, flag2);
% %
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% % Description
% %
% % save_a_plot2_audiological(a, filename);
% %
% % Saves the current figure to a file named by teh string input filename
% % using the specified format given by the integer a. The default format
% % is pdf. The default file name is 'default_file_name'.
% %
% % The options for the format are
% %
% % a=1; % pdf
% % a=2; % fig
% % a=3; % jpeg 200 dpi
% % a=4; % epsc 200 dpi
% % a=5; % tiff 200 dpi
% % a=6; % no compression tiff
% %
% % save_a_plot2_audiological(a, filename, flag2);
% % orients the paper usign teh integer intoput flag2.
% % Flag2=1, orients the paper in portrait.
% % For any other value of Flag2 the paper is in landscape.
% % The default paper orientation is portrait.
% %
% %
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% Example='';
% figure(1);
% plot([-1 1],[-1 1]); % make a figure to save
% a=1; % 1 pdf
% % 2 fig
% % 3 jpeg 200 dpi
% % 4 epsc 200 dpi
% % 5 tiff 200 dpi
% % 6 no compression tiff
%
% filename='straightline'; % The file name is a string
%
% flag2=0; % Orient the paper in landscape.
% % Values other than 1 result in landscape
% % orientation.
%
% save_a_plot2_audiological(a, filename, flag2);
%
% %
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% % Program Written by Edward L. Zechmann
% % date April 2007
% % modified 27 December 2007 Added a description and an example
% % Added comments
% %
% % modified 21 August 2008 Updated Comments
% %
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% % Please feel free to modify this code.
% %
% % See Also: print, saveas
% %
rect=[0.05 0.05 0.85 0.85];
hf=gcf;
if nargin < 1
a=1;
end
if nargin < 2
filename='default_file_name';
end
if nargin < 3
flag2=1;
end
if flag2 == 1
orientation='portrait';
else
orientation='landscape';
end
set(hf, 'PaperOrientation', orientation, 'PaperType', 'usletter', 'PaperUnits', 'normalized', 'PaperPosition', rect, 'PaperSize', 0.6*[1.3 0.6] );
[filename, ext]=file_extension(filename);
if a == 1
set(hf, 'PaperOrientation', orientation, 'PaperType', 'usletter', 'PaperUnits', 'normalized', 'PaperPosition', rect );
print(hf, '-dpdf', filename );
elseif a == 2
saveas(hf, filename, 'fig' );
elseif a == 3
print(hf, '-djpeg', '-r200', filename );
elseif a == 4
print(hf, '-depsc2', '-r200', filename );
elseif a == 5
print(hf, '-dtiff', '-r200', filename );
elseif a == 6
print(hf, '-dtiffn', filename );
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -