% mk_mat_ctd.m - to make cast data into .mat files EDDIES 07/05

%change dirs here
thedir='/mnt/oc415-2a/oc415_2/ctd/process';
%thedir='offcd';


%for ii = 1:9
for ii = [25:29]
  disp(int2str(ii))
  %ii = input('Enter Cast number: ');
  %ii = cast;
  if 0
    % no need to take off header since it begins with a '%' but it
    % doesn't hurt anything
    if ii < 10
      eval(['!tail +2 ../',thedir,'/sj011200',int2str(ii),'.asc > data'])
    elseif ii < 100
      eval(['!tail +2 ../',thedir,'/sj01120',int2str(ii),'.asc > data'])
    elseif ii < 1000
      eval(['!tail +2 ../',thedir,'/sj0112',int2str(ii),'.asc > data'])
    end
  else
    if ii < 10
      eval(['!\cp ',thedir,'/oc41520',int2str(ii),'.flt data'])
    elseif ii < 100
      disp('loading data')
      eval(['!\cp ',thedir,'/oc4152',int2str(ii),'.flt data'])
    end
  end

  load data
  press = data(:,1);
  t0 = data(:,2);
  c0 = data(:,3);
  s0 = data(:,4);
  t1 = data(:,5);
  c1 = data(:,6);
  s1 = data(:,7);
  o2 = data(:,8);
  par = data(:,9);
  chl = data(:,10);


  if ii < 10
    eval(['save ',thedir,'/oc41520',int2str(ii), ...
	  ' press t0 t1 c0 c1 s0 s1 o2 par chl']);
  elseif ii < 100
    disp('saving data fn:')
    disp([thedir,'/oc4152',int2str(ii)])
    eval(['save ',thedir,'/oc4152',int2str(ii), ...
	  ' press t0 t1 c0 c1 s0 s1 o2 par chl']);
  end

end
