Home > rest_20090422 > rest_spm5_files > nic_spm_print.m

nic_spm_print

PURPOSE ^

Print the graphics window

SYNOPSIS ^

function nic_spm_print(fname)

DESCRIPTION ^

 Print the graphics window
____________________________________________________________________________
 Copyright (C) 2005 Wellcome Department of Imaging Neuroscienic_e

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

nic_spm_print.m

SOURCE CODE ^

0001 function nic_spm_print(fname)
0002 % Print the graphics window
0003 %____________________________________________________________________________
0004 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscienic_e
0005 
0006 % John Ashburner
0007 % $Id: spm_print.m 112 2005-05-04 18:20:52Z john $
0008 
0009 
0010 global defaults
0011 try,
0012 
0013     if isfield(defaults,'ui') && isfield(defaults.ui,'print'),
0014         pd = defaults.ui.print;
0015     else
0016         pd = struct('opt',{{'-dpsc2'  '-append'}},'append',true,'ext','.ps');
0017     end;
0018 
0019     mon = {'Jan','Feb','Mar','Apr','May','Jun',...
0020             'Jul','Aug','Sep','Oct','Nov','Dec'};
0021     t   = clock;
0022     nam = ['spm_' num2str(t(1)) mon{t(2)} sprintf('%.2d',t(3))];
0023 
0024     if nargin<1,
0025         if pd.append,
0026             nam1 = fullfile(pwd,[nam pd.ext]);
0027         else
0028             nam1 = sprintf('%s_%3d',nam,1);
0029             for i=1:100000,
0030                 nam1 = fullfile(pwd,sprintf('%s_%.3d%s',nam,i,pd.ext));
0031                 if ~exist(nam1,'file'), break; end;
0032             end;
0033         end;
0034     else
0035         nam1 = fname;
0036     end;
0037     opts = {nam1,'-noui','-painters',pd.opt{:}};
0038     print(opts{:});
0039 catch,
0040     errstr = lasterr;
0041     tmp = [find(abs(errstr)==10),length(errstr)+1];
0042     str = {errstr(1:tmp(1)-1)};
0043     for i = 1:length(tmp)-1
0044         if tmp(i)+1 < tmp(i+1)
0045             str = [str, {errstr(tmp(i)+1:tmp(i+1)-1)}];
0046         end
0047     end
0048     str = {str{:},  '','- Print options are:', opts{:},...
0049                     '','- Current directory is:',['    ',pwd],...
0050                     '','            * nothing has been printed *'};
0051     nic_spm('alert!',str,'printing problem...',sqrt(-1));
0052 end;

Generated on Wed 29-Apr-2009 01:06:38 by m2html © 2005