function newarray=zeroize(array,badval)
%function newarray=zeroize(array,badval)
% replaces badval with zero
%
newarray=array;
[imax,jmax]=size(array);
if imax<jmax
  for i=1:imax
     bad=find(array(i,:)==badval);
     if length(bad)>0
         newarray(i,bad)=zeros(1,length(bad));
     end
  end
else
  for i=1:jmax
     bad=find(array(:,i)==badval);
     if length(bad)>0 
         newarray(bad,i)=zeros(length(bad),1);
     end
   end
end
