www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@sweepset/preprocess.m
function [x,y] = preprocess(x,y) %PREPROCESS Adjust sweepset values % % [SS1, SS2] = PREPROCESS(SS1, SS2) does the following: % % Shifts x, so that we have no -ve values % Shifts y, so that we have no -ve values % Sorts the data. % Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. % Check to see if X and Y are the same length if size(x,3)~=size(y,3) error(message('mbc:sweepset:InvalidArgument10')); end % Positive values only x(y<0)=NaN; y(y<0)=NaN; y(x<0)=NaN; x(x<0)=NaN; % remove bad sweeps x=x(~isbad(y)); y=y(~isbad(y)); % choose sweeps with > 4 data points tstartx=tstart(x); index=diff(tstartx)<5; index(end+1)=(size(x,1)-tstartx(end))<5; x(:,:,index)=NaN; y(:,:,index)=NaN; % remove bad sweeps x=x(~isbad(y)); y=y(~isbad(y));