0001 function [idx,n_clipped]=nt_find_clipped_trials(x,threshold,bounds)
0002
0003 error('not yet implemented')
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 if nargin<2; threshold=0; end
0018 if nargin<3; bounds=[]; end
0019 if threshold>1; error('proportion should be within [0 1])'); end
0020
0021 if nargout==0;
0022 [idx,n]=nt_find_outlier_trials(x,proportion,mn);
0023 plot(n);
0024 xlabel('trial'); ylabel('number clipped');
0025 clear idx n
0026 return
0027 end
0028
0029 [m,n,o]=size(x);
0030
0031 mx=max(nt_unfold(x));
0032 mn=min(nt_unfold(x));
0033
0034 x1=repmat(mx,[m,1,o])-x;
0035 x1=min(x1,[],2);
0036 x2=x-repmat(mn,[m,1,o]);
0037 x2=min(x2,[],2);
0038 xx=min(x1,x2);
0039
0040 y=zeros([m,1,o]);
0041 y(find(xx==0))=1;
0042 y=reshape(y,[m,o]); y=sum(y);
0043
0044 plot(y);
0045