Home > vbmeg > functions > common > utility > vb_savefig_as_shown.m

vb_savefig_as_shown

PURPOSE ^

Save figure as it is shown

SYNOPSIS ^

function vb_savefig_as_shown(fig, filename, formattype)

DESCRIPTION ^

 Save figure as it is shown

 - Input
   fig : Figure number
   filename : File name
   formattype : File format (default : '-dpng')

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vb_savefig_as_shown(fig, filename, formattype)
0002 % Save figure as it is shown
0003 %
0004 % - Input
0005 %   fig : Figure number
0006 %   filename : File name
0007 %   formattype : File format (default : '-dpng')
0008 %
0009 % Copyright (C) 2011, ATR All Rights Reserved.
0010 % License : New BSD License(see VBMEG_LICENSE.txt)
0011 
0012 if nargin < 3
0013     formattype = '-dpng';
0014 end
0015 
0016 % Make directory to save figure if it does not exist
0017 [PATH, NAME, EXT] = vb_get_file_parts(filename);
0018 if ~isempty(PATH) && ~exist(PATH, 'dir')
0019     vb_mkdir(PATH);
0020     vb_disp(['Create directory: ' PATH]);
0021 end
0022 
0023 set(fig, 'InvertHardCopy', 'off');
0024 set(fig, 'PaperPositionMode', 'auto')
0025 
0026 print(fig, filename, formattype, '-r0')

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005