12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- function [PSRout, Nout]=MakePSR0int(Nrast,EintS,EintE,PRMS,Int)
- %Eint is the interval start and end
- %PRMS=2 give a PSR cell {neurons,trials} and PRMS=1 collapses all the trials >
- %cell{neurons,1}
- %N is the number of interval
- %Int: 1=iti. 2=trial
- inttype=Int{1};
- if inttype==1
- Timeshift=10;
- elseif inttype==2
- Timeshift=0;
- end
- Otype=PRMS{1};
- FLAG=0;
- if length(PRMS)>1
- FLAG=1;
- end
- if Otype==1
- PSRout=cell(size(Nrast,1),1);
- for i=1:length(Nrast)
-
- for k=1:size(EintS,1)
- if FLAG==0
- tmp=Nrast{i};
- PSRout{i}=cat(1,PSRout{i},tmp(tmp>EintS(k,1)+Timeshift & tmp<EintE(k,1)-Timeshift));
- else
- PSRout{i}=cat(1,PSRout{i},tmp(find(tmp>EintS(k,1)+Timeshift & tmp<EintE(k,1)-Timeshift),1,PRMS{2}));
- end
- end
-
- end
- elseif Otype==2
-
- PSRout=cell(size(Nrast,1),size(EintS,1)); %PSRout is a cell(neurons,intervals)
- for i=1:length(Nrast) %loops through the number of neurons
-
- for k=1:size(EintS,1) %loops through interval, exclude the 1st interval
- tmp=Nrast{i};
- if ~isempty(find(tmp>EintS(k,1) & tmp<EintE(k,1), 1))
- if FLAG==0
- PSRout{i,k}=tmp(tmp>EintS(k,1)+Timeshift & tmp<EintE(k,1)-Timeshift);
- else
- PSRout{i,k}=tmp(find(tmp(tmp>EintS(k,1)+Timeshift & tmp<EintE(k,1)-Timeshift),1,PRMS{2}));
- end
- else
- PSRout{i,k}=NaN;
- end
- end
-
- end
- end
- Nout=size(EintS,1)-1;
|