cd 'C:Program FilesMATLABR2006awork';
filelist = dir('*.mat');
isis=[];
load('ppplh00.mat')
for n=1:length(trials)
if (isfield(trials(n).stim,'ontime')&&isfield(trials(n).stim,'changeframe')&& trials(n).changeloc==0) %&& isfield(trials(n).stim, 'offtime')
if ~isempty(trials(n).saccade) & ~isempty(trials(n).sacend) & trials(n).sacend.azimuth>0
if sum(find(trials(n).sp))>=2
spikes=trials(n).sp;
stimon=trials(n).stim.ontime;
spikes(find(spikes
isi=spikes(2:end)-spikes(1:end-1);
isis(end+1:end+length(isi)) = isi;
end
end
end
end
isis2=sort(isis);
m=round(max(isis2)+1);
b1=0;
b2=b1+1;
for binwidth=1:m;
k=find(isis2>b1 & isis2<=b2);
l=length(k);
j(binwidth)=l/length(isis2);
b1=b1+1;
b2=b2+1;
end
plot(j,'g')
hold on
x=mean(isis2);
for z=1:m;
y(z)=exppdf(z,x);
end
plot(y,'b')
hold on
for z=1:m;
f(z)=poisspdf(z,x);
end
plot(f,'r')
h1=kstest2(j,y,0.05)
p=j(find(j<0.016));
q=y(find(y<0.016));
h2=kstest2(p,q,0.05)