% This writes out the gridedited bathymetry to
% the ECOM "model_grid" format
% from the gridedit object, which is assumed
% to have already been made GLOBAL

%this part should be run directly after 'grid_edit_step1';
% (or during the gridediting process)
u=grid_obj.u;
u=replace(u,nan,-99999.00);
u=(u');
%u=flipud(u');
data(:,5)=u(:);

fid=fopen(newgrid,'w');
   for i=1:length(str);
     fprintf(fid,'%s\n',str{i});
   end
%  fprintf(fid,'%4d%4d%10.2f%10.2f%10.2f%7.1f%7.1f%5.2f %12.5f %12.5f\n',data');
  fprintf(fid,'%4d%4d%10.2f%10.2f%10.2f%7.1f%7.1f%5.2f %12.1f %12.1f\n',data');
fclose(fid);
