1234567891011121314151617181920212223242526272829303132333435 |
- function [outDev,outStd,nDevAcc,nStdAcc] = sortBlck(inData,seqAcc,nTrialsAcc,AfrqI,BfrqI,runType)
- %SORTBLCK Divides blocks into deviant and standard responses
- % Detailed explanation goes here
- % define some variables
- pSmpl = size(inData,1);
- nTrials = size(inData,2);
- nBlcks = size(inData,3);
- nFiles = size(inData,4);
- nFilt = size(inData,5);
- % apply sequence on each block
- nDevAcc = zeros(nBlcks,nFiles); % preallocate
- nStdAcc = zeros(nBlcks,nFiles); % preallocate
- outDev = zeros(pSmpl,nTrials,nBlcks,nFiles,nFilt); % preallocate
- outStd = zeros(pSmpl,nTrials,nBlcks,nFiles,nFilt); % preallocate
- for f = 1:nFiles
- for b = 1:nBlcks
- % create sequences
- switch runType
- case {1,2}
- seqDev = logical(seqAcc(1:nTrialsAcc(b,f),b,f));
- seqStd = ~seqAcc(1:nTrialsAcc(b,f),b,f);
- case 3
- seqDev = seqAcc(1:nTrialsAcc(b,f),b,f)==AfrqI;
- seqStd = seqAcc(1:nTrialsAcc(b,f),b,f)==BfrqI;
- end
- nDevAcc(b,f) = sum(seqDev);
- nStdAcc(b,f) = sum(seqStd);
- % apply sequences on data
- outDev(:,1:nDevAcc(b,f),b,f,:) = inData(:,seqDev,b,f,:);
- outStd(:,1:nStdAcc(b,f),b,f,:) = inData(:,seqStd,b,f,:);
- end
- end
- end
|