123456789101112131415161718192021222324252627282930313233 |
- function pooltwspksq = getTimewinsPoolSpikeSeqs(poolstackvars,poolstackspks)
- if nargin<2
- subjsData(1).sbdata=getSubjectData(1);
- subjsData(2).sbdata=getSubjectData(2);
- poolstackspks=getPoolStackSpks(subjsData);
- if nargin<1
- poolstackvars=getPoolStackVars(subjsData);
- end
- end
- Nsns=size(poolstackspks,1);
- Ntws=size(poolstackspks,2);
- Ncells=arrayfun(@(sn) poolstackvars(sn).ncells, 1:Nsns);
- Ntrs=arrayfun(@(sn) size(poolstackvars(sn).offer1sd,1),1:Nsns);
- Ntps=arrayfun(@(tw) max(arrayfun(@(sn) size(poolstackspks(sn,tw).spksq,3), 1:8)),1:8);
- Ntrs12=max(Ntrs);
- pooltwspksq(1:8)=struct();
- for tw=1:Ntws
- currcatspkseqs=[];
- for sn=1:Nsns
- currNtps=size(poolstackspks(sn,tw).spksq,3);
- currcatspkseqs=cat(2, currcatspkseqs, ...
- cat(1, cat(3,poolstackspks(sn,tw).spksq,nan(Ntrs(sn),Ncells(sn),Ntps(tw)-currNtps)), nan(Ntrs12-Ntrs(sn),Ncells(sn),Ntps(tw))));
- end
- pooltwspksq(tw).spkseqs=currcatspkseqs;
- tempspks=permute(currcatspkseqs,[3 1 2]);
- pooltwspksq(tw).covhist=sum(~isnan(tempspks(:,:)),2)./sum(Ncells.*Ntrs);
- end
- end
|