function []=mattosurf(var,name,xy);
%function []=mattosurf(var,name,xy);
%           takes matlab variable and writes a surfer file named 'name'
%           the orientation of the array should be (xlen,ylen)=size(array)
%               xy is array [xmin xmax ymin ymax]  (default for GH)
var=denanize(var,1.701411e38);
var=var';
save tempgrid xy var 
!e:\surf\mattosurf
!del tempgrid.mat
eval(['!copy tempgrid.grd 'name,'.grd'])
!del tempgrid.grd
eval(['!topo  /titstr="',name,'" ',name])
