Excise.m

From Pnb
Revision as of 14:52, 5 August 2010 by 128.111.101.185 (talk) (Created page with '<pre> % 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 (: functio…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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