% function PASwriterecord(filename,record,comments)
%   VERSION=1.0;
%   
%   [fd,syserrmsg]=fopen(filename,'wt');
%   if (fd==-1),
%     PASmsg=sprintf('Could not open %s for writing',filename);
%     PASerrmsg(PASmsg,syserrmsg); 
%   end;
%   if (~iscell(comments)),PASerrmsg('Comments must be a cell array','');end;
%   
%   nobjs=length(record.objects);
%   objlabels=sprintf(' "%s"',record.objects(:).label);
%   fprintf(fd,'Image: "%s"\n',record.imgname);
%   fprintf(fd,'Top left pixel co-ordinates : (1, 1), bounding boxes have form: Xmin Ymin Xmax Ymax \n');
%   for i=1:nobjs,
%     %lbl=record.objects(i).label;
%     fprintf(fd,'%d %d %d %d\n',record.objects(i).bbox);
%   end;
%   fclose(fd);
% return


function PASwriterecord(filename,record,comments)
  VERSION=1.0;
  
  [fd,syserrmsg]=fopen(filename,'wt');
  if (fd==-1),
    PASmsg=sprintf('Could not open %s for writing',filename);
    PASerrmsg(PASmsg,syserrmsg); 
  end;
  if (~iscell(comments)),PASerrmsg('Comments must be a cell array','');end;
  
  nobjs=length(record.objects);
  objlabels=sprintf(' "%s"',record.objects(:).label);
%   fprintf(fd,'Image: "%s"\n',record.imgname);
%   fprintf(fd,'Top left pixel co-ordinates : (1, 1), bounding boxes have form: Xmin Ymin Xmax Ymax \n');
  for i=1:nobjs,
    %lbl=record.objects(i).label;
    fprintf(fd,'%d %d %d %d\n',record.objects(i).bbox);
  end;
  fclose(fd);
return