Revision a9f38bb8535cb5e7bf719da6e9070bc256a827a9 authored by MSchonewille on 09 July 2019, 07:16:54 UTC, committed by GitHub on 09 July 2019, 07:16:54 UTC
Matlab routines to analyze compensatory eye movements recorded using the Iscan system (120Hz) in mice.
1 parent 836f605
Raw File
takeoutsac1.m
function qq=takeoutsac1(cc,sf)

global AHANDLE
presactime=0.02; %seconds
postsactime=0.08; %seconds
presacbin=round(presactime*sf(1));
postsacbin=round(postsactime*sf(1));
aa=abs(cc);
[bb,i]=sort(aa);

%find cut off
le=length(bb);
med=round(le/2);
cut=75; 
r=find(bb>cut);
qw=isempty(r);

if qw==1
   bb(1:le)=1;
   accbin(i)=bb;
else
   v=axis;
   l(2)=line([aa(r(1)) aa(r(1))],[v(3) v(4)]);
   l(3)=line([v(1) v(2)],[cut cut]);
   set (l(2),'color',[1 0 0])
   set (l(3),'color',[1 0 0])
   drawnow
   bb(1:r)=1;
   bb((r+1):end)=0;
   accbin(i)=bb;
   
   ll=find(accbin<1);
   for x=1:length(ll)
      if ll(x)>251
         accbin(ll(x)-presacbin:ll(x)+postsacbin)=0;
         else
         accbin(1:ll(x)+postsacbin)=0;
      end
   end
end

qq=accbin(1:length(i));
disp('takeoutsac1');
back to top