0001 function print_fig(obj, filename, printstr)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 if nargin < 2
0016 filename = [];
0017 end
0018 if isempty(filename)
0019 filename = obj.printfile;
0020 end
0021 if nargin < 3
0022 printstr = '';
0023 end
0024 if isempty(printstr)
0025 printstr = obj.printstr;
0026 end
0027
0028
0029 cF = get(0,'CurrentFigure');
0030 set(0,'CurrentFigure',obj.figure)
0031
0032
0033
0034
0035 H = findobj(get(obj.figure,'Children'),'flat','Type','axes');
0036 un = cellstr(get(H,'Units'));
0037 set(H,'Units','normalized')
0038
0039
0040
0041 err = 0;
0042 try, eval([printstr ' ' filename]), catch, err=1; end
0043 if err
0044 errstr = lasterr;
0045 tmp = [find(abs(errstr)==10),length(errstr)+1];
0046 str = {errstr(1:tmp(1)-1)};
0047 for i = 1:length(tmp)-1
0048 if tmp(i)+1 < tmp(i+1)
0049 str = [str, {errstr(tmp(i)+1:tmp(i+1)-1)}];
0050 end
0051 end
0052 str = {str{:}, '','- print command is:',[' ',printstr ' ' filename],...
0053 '','- current directory is:',[' ',pwd],...
0054 '',' * nothing has been printed *'};
0055 for i=1:length(str)
0056 disp(str{i});end
0057 end
0058
0059 set(H,{'Units'},un)
0060 set(0,'CurrentFigure',cF)
0061
0062 return