function [h,hx,hy]=remove_inlets(h,hx,hy) % % Remove simple inlets % % e.g. % [H2,Hx2,Hy2]=remove_inlets(H2,Hx2,Hy2); if size(h)~=size(hx) | size(h)~=size(hy) error('Arguments must all be the same size!\n'); end oh=h+1; while ( sum(oh(:)-h(:)) ) oh=h; % Find second deepest side hh(1,:,:,:)=hx; hh(2,:,:,:)=hx([2:end 1],:,:); hh(3,:,:,:)=hy; hh(4,:,:,:)=hy(:,[2:end end],:); hh=sort(hh); % Remove inlets h=squeeze(hh(2,:,:,:)); % Regenerate side walls hX=max(h,h([end 1:end-1],:,:)); hx=max(hx,hX); hY=max(h,h(:,[1 1:end-1],:)); hy=max(hy,hY); end