addpath /contrib/matlab
ncstartup
T_in_file = 'WOCE_PTEMP_MODIFIED_gx3v6_climatology.nc' ;
S_in_file = 'WOCE_SALT_MODIFIED_gx3v6_climatology.nc' ;
out_file = 'WOCE_MODIFIED_ic_gx3v6.ieeed' ;

fid_out = fopen(out_file, 'w+');

fid_in = netcdf(T_in_file, 'nowrite');
km = length(fid_in{'depth'}(:));
for k=1:km,
   slab = transpose(fid_in{'TEMPERATURE_MODIFIED'}(k,:,:));
   fwrite(fid_out,slab,'double');
end;
close(fid_in);

fid_in = netcdf(S_in_file, 'nowrite');
km = length(fid_in{'depth'}(:));
for k=1:km,
   slab = transpose(fid_in{'SALINITY_MODIFIED'}(k,:,:));
   fwrite(fid_out,slab,'double');
end;
close(fid_in);

fclose(fid_out);

