Excise.m

From Pnb
Jump to navigation Jump to search
% EXCISE.M
% Mfile to excise any row containing data less than thresholds. 
% Used to remove rows of data with TRAPFLAGS in them.
% Created: JCS - someTime 1992 (:

function x=excise(x, LOWER_THRESHOLD, UPPER_THRESHOLD)

if exist('UPPER_THRESHOLD') ~= 1,
	UPPER_THRESHOLD = 1e34;
end
if exist('LOWER_THRESHOLD') ~= 1,
	LOWER_THRESHOLD = -800;
end



[m,n]=size(x);
trap= (x < LOWER_THRESHOLD | x > UPPER_THRESHOLD | isnan(x) == 1 | isinf(x) == 1);
if n > 1, 
  x(any(trap'),:)=[];
else,
  x(find(trap),:)=[];
end

excise