
% Set the following for the station range desired
jsta = 74:123; 
ndepth = 2750;

nsta = length(jsta);
T = zeros(ndepth,nsta);
S = T;
p =  ((1:ndepth) - 1) * 2;

for ii = jsta
   chdir ascii_ctd
   eval(['load ' sprintf('c%03.0f',ii) '.ctd']);
   chdir ../
   eval(['T(:,ii-jsta(1)+1) = pad(c' sprintf('%03.0f',ii) '(:,2),ndepth);']);
   eval(['S(:,ii-jsta(1)+1) = pad(c' sprintf('%03.0f',ii) '(:,3),ndepth);']);
   eval(['clear ' sprintf('c%03.0f',ii)]);

end

load xy.asc
y = xy(jsta,4) .* (xy(jsta,2) + xy(jsta,3)/60);  %change N to 1, S to -1
x = 360 -(xy(jsta,5) + xy(jsta,6)/60);          % no need
                                          % for sign for Lon on this cruise


eval(['save ' sprintf('ts%.0f_%.0f', jsta(1), jsta(nsta))...
  ' T S p x y jsta nsta ndepth']);

