Makeup.m

From Pnb
Revision as of 15:23, 5 August 2010 by 128.111.101.185 (talk) (Created page with '<pre> function makeup(pb) %created by Erik Stassinos %function to create upused.txt %prints formatted file using list_ac9mdz, ac9file or read file date and ctd %file name %cd(pb…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
function makeup(pb)
%created by Erik Stassinos
%function to create upused.txt
%prints formatted file using list_ac9mdz, ac9file or read file date and ctd
%file name

%cd(pb)

list = fopen('list_ac9bmdz')
if list == -1
    sprintf('function is designed to run with a list_ac9mdz file. Exiting')
    return
end
ac9file = fopen('ac9file.txt','r')
if ac9file == -1
    sprintf('cannot locate ac9file.txt in the current directory. Exiting')
    return
end


upusd = fopen('upused.txt','w+');

   
  pattern1 = fullfile(pwd,'*.asc.1');
  pattern2 = fullfile(pwd,'*.asc.2');
  datlist1 = dir(pattern1)
  datlist2 = dir(pattern2);
count=0;
while feof(list) ~=1
    fgets(list);
    count = count +1;
end
frewind(list)

for i = 1:(count/2 -1)  %No x cast
    
   procname = fgets(list);
   pname = textscan(procname,'%s');
   pname = char(pname{1,:});
   ac9 = fgets(ac9file);
   date = textscan(ac9,'%*s %*s %s %*s');
   date = char(date{1,:});
   time1 = textscan(ac9,'%*s %*s %*s %s');
   time1 = char(time1{1,:});
   time2 = time1;
  d=  datlist1(i).name;
 
   %fprintf(upusd,'%s %s %s %s %s %s %s %s\n','flags', pb,procname,date,time1,datlist1(i).name,'qcal\n')
   fprintf(upusd,'%s','flags');
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',pb);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',pname);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',date);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',time1);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',datlist1(i).name);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s\n','qcal');
   procname = fgets(list);
   pname = textscan(procname,'%s');
   pname = char(pname{1,:});
   fprintf(upusd,'%s','flags');
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',pb);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',pname);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',date);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',time2);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s',datlist2(i).name);
   fprintf(upusd,'%s','  ');
   fprintf(upusd,'%s\n','qcal');
   %procname = fgets(list);
  % fprintf(upusd,'%s %s %s %s %s %s %s\n','flags', pb,procname,date,time1,datlist2(i).name,'qcal')
  sprintf('create upused done')
end
   

makeup