Home > published > printit.m

printit

PURPOSE ^

PRINTIT Prints the figure numbered "input"

SYNOPSIS ^

function printit( input )

DESCRIPTION ^

PRINTIT Prints the figure numbered "input"
Detects OS-type and makes jpg on Windows or .eps on Linux
Global variable COLOUR determines whether 
 EPS is color (COLOUR=1) or B/W (COLOUR=0)
 orientation is color (ORIENT=1) or Portrait (ORIENT=0)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

function printit( input )
%PRINTIT Prints the figure numbered "input"
%Detects OS-type and makes jpg on Windows or .eps on Linux
%Global variable COLOUR determines whether
% EPS is color (COLOUR=1) or B/W (COLOUR=0)
% orientation is color (ORIENT=1) or Portrait (ORIENT=0)
global COLOUR
global ORIENT
orient portrait
if ORIENT==1 orient landscape; end
ostype='windows';
if isunix==1 ostype='linux__'; end
disp(strcat('Detected_',ostype,' OS'));

if ostype=='windows'
    filetype='.jpeg';
else
    filetype='.eps ';
    if COLOUR==1 filetype='.epsc'; end
end

figure(input)
   autoname=1;
if autoname==0    
   fn=strcat('temp',filetype);
else
   temp=date; temp2=clock;
   hour=num2str(temp2(4),'%02i'); min=num2str(temp2(5),'%02i'); sec=num2str(fix(temp2(6)),'%02i');
   fn=strcat('auto_',date,'_',hour,min,sec,filetype)
end
   if filetype=='.jpeg' 
        print( '-djpeg', '-r300', fn ); 
   end
   if filetype=='.eps '    
        print( '-painters','-deps2', '-r300', fn ); 
   end
   if filetype=='.epsc' 
    print( '-painters','-depsc2', '-r300', fn ); 
   end
   if ostype=='windows' 
        return; 
   end
   if filetype=='.jpeg' 
    system(['xv ',fn,' &']); 
   end
   if (filetype =='.epsc' | filetype == '.eps ')
    disp('hi')
    system(['/usr/bin/gv ',fn,' &']); 
   end
   %system(['/usr/X11R6/bin/gv ',fn,' &']);

Generated on Fri 07-Nov-2008 13:46:59 by m2html © 2005