function fig = figureprep(pos,wantvisible) <pos> (optional) is a position like in setfigurepos.m <wantvisible> (optional) is whether to keep the window visible. default: 0. make a new invisible figure window and set hold on. then, if <pos> is supplied, set the position of the window. return a handle to the figure window. use in conjunction with figurewrite.m. example: figureprep; scatter(randn(100,1),randn(100,1)); figurewrite;
0001 function fig = figureprep(pos,wantvisible) 0002 0003 % function fig = figureprep(pos,wantvisible) 0004 % 0005 % <pos> (optional) is a position like in setfigurepos.m 0006 % <wantvisible> (optional) is whether to keep the window visible. default: 0. 0007 % 0008 % make a new invisible figure window and set hold on. 0009 % then, if <pos> is supplied, set the position of the window. 0010 % return a handle to the figure window. 0011 % 0012 % use in conjunction with figurewrite.m. 0013 % 0014 % example: 0015 % figureprep; 0016 % scatter(randn(100,1),randn(100,1)); 0017 % figurewrite; 0018 0019 % input 0020 if ~exist('pos','var') || isempty(pos) 0021 pos = []; 0022 end 0023 if ~exist('wantvisible','var') || isempty(wantvisible) 0024 wantvisible = 0; 0025 end 0026 0027 % do it 0028 fig = figure; hold on; 0029 if ~wantvisible 0030 set(fig,'Visible','off'); 0031 end 0032 if ~isempty(pos) 0033 setfigurepos(pos); 0034 end