


PURPOSE: colfilt function to calculate the mean of the highest 25% altitude values. Returns NaN if more than 50% of input cells are NaN, else removes NaN cells for calculation. See also: colfilt() Felix Hebeler, Geography Dept., University Zurich, Jan 2007.


0001 function [r] = hypsom_median(X) 0002 % PURPOSE: colfilt function to calculate the mean of the highest 25% 0003 % altitude values. Returns NaN if more than 50% of input cells are NaN, 0004 % else removes NaN cells for calculation. 0005 % 0006 % See also: colfilt() 0007 % 0008 % Felix Hebeler, Geography Dept., University Zurich, Jan 2007. 0009 0010 n=sum(isnan(X(:))); 0011 if n>0 0012 if n>=numel(X)/2 0013 r=nan; 0014 return 0015 else 0016 X(isnan(X))=[]; 0017 end 0018 end 0019 r=median(X(:));