function ifprint(fig,file,autop,append);

% conditional printing to postscript file
% input:
%	fig = handle of figure to print
%	file = name of file to print to
%	autop = 1 then print, else do nothing
%	append = 1 if should append to previous plot,
%		otherwise, overwrite previous plot
% output:
%	postscript file of the plot
%

if autop == 1;
  figure(fig);

  if append == 1;
    cmd = ['print ', file ,' -dps2 -append']
  else
    cmd = ['print ', file ,' -dps2']
  end;

  eval(cmd);
end;
  
