Home > GLMdenoise > utilities > figurewrite.m

figurewrite

PURPOSE ^

function figurewrite(prefix,num,mode,outputdir,omitclose)

SYNOPSIS ^

function figurewrite(prefix,num,mode,outputdir,omitclose)

DESCRIPTION ^

 function figurewrite(prefix,num,mode,outputdir,omitclose)

 <prefix> (optional) is the filename prefix.  the prefix can include in it
   '%d' (or a variant thereof) for the figure number.  you can pass in
   a number and we automatically convert it using num2str.
   default: '%d'.
 <num> (optional) is a number to use instead of the figure number
 <mode> (optional) is like in printnice.m.  can also be a cell vector,
   in which we loop over the elements.  default: [1 72].
   special case is -1 which means {0 [1 72]}.
 <outputdir> (optional) is the directory to write to.  default: pwd.
   we automatically make the directory if it doesn't exist.
 <omitclose> (optional) is whether to omit the closing of the figure.  default: 0.

 print current figure to <prefix>.[png,eps] and then close figure.
 can use in conjunction with figureprep.m.

 example:
 figureprep;
 scatter(randn(100,1),randn(100,1));
 figurewrite;

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function figurewrite(prefix,num,mode,outputdir,omitclose)
0002 
0003 % function figurewrite(prefix,num,mode,outputdir,omitclose)
0004 %
0005 % <prefix> (optional) is the filename prefix.  the prefix can include in it
0006 %   '%d' (or a variant thereof) for the figure number.  you can pass in
0007 %   a number and we automatically convert it using num2str.
0008 %   default: '%d'.
0009 % <num> (optional) is a number to use instead of the figure number
0010 % <mode> (optional) is like in printnice.m.  can also be a cell vector,
0011 %   in which we loop over the elements.  default: [1 72].
0012 %   special case is -1 which means {0 [1 72]}.
0013 % <outputdir> (optional) is the directory to write to.  default: pwd.
0014 %   we automatically make the directory if it doesn't exist.
0015 % <omitclose> (optional) is whether to omit the closing of the figure.  default: 0.
0016 %
0017 % print current figure to <prefix>.[png,eps] and then close figure.
0018 % can use in conjunction with figureprep.m.
0019 %
0020 % example:
0021 % figureprep;
0022 % scatter(randn(100,1),randn(100,1));
0023 % figurewrite;
0024 
0025 % SEE: printnice.m.
0026 
0027 % input
0028 if ~exist('prefix','var') || isempty(prefix)
0029   prefix = '%d';
0030 end
0031 if ~exist('num','var') || isempty(num)
0032   num = [];
0033 end
0034 if ~exist('mode','var') || isempty(mode)
0035   mode = [1 72];
0036 end
0037 if ~exist('outputdir','var') || isempty(outputdir)
0038   outputdir = pwd;
0039 end
0040 if ~exist('omitclose','var') || isempty(omitclose)
0041   omitclose = 0;
0042 end
0043 if isequal(mode,-1)
0044   mode = {0 [1 72]};
0045 end
0046 if ~iscell(mode)
0047   mode = {mode};
0048 end
0049 
0050 % do it
0051 for p=1:length(mode)
0052   if isempty(num)
0053     printnice([],mode{p},outputdir,prefix);
0054   else
0055     printnice([],mode{p},outputdir,sprintf(prefix,num));
0056   end
0057 end
0058 if ~omitclose
0059   close;
0060 end

Generated on Fri 01-Aug-2014 12:03:17 by m2html © 2005