function [h,hx,hy]=fill_potholes(h,hx,hy) % % Fills "pot holes": holes deeper than all neighbouring sides % % e.g. % [H2,Hx2,Hy2]=fill_potholes(H2,Hx2,Hy2); if size(h)~=size(hx) | size(h)~=size(hy) error('Arguments must all be the same size!\n'); end % Fill-up cell-centers where all sides are higher Hsides=min( hx, hx([2:end 1],:,:) ); Hsides=min( Hsides, hy ); Hsides=min( Hsides, hy(:,[2:end end],:) ); h=max( h, Hsides );