-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetSlotPerms.m
More file actions
36 lines (32 loc) · 909 Bytes
/
getSlotPerms.m
File metadata and controls
36 lines (32 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function [SlotPerms] = getSlotPerms()
if exist('SlotPerms.mat','file')
X = load('SlotPerms.mat');
SlotPerms = X.SlotPerms;
return
end
rng(1729);
nImgs = 54;
nRuns = 4;
nRepsPerRun = 5;
nNullsPerRep = 3;
countStats = [
86 62 91 76 Inf
71 82 66 95 Inf
93 64 85 78 Inf
96 61 89 79 Inf];
% Slot permulations (1-ordered + NaNs, common across all subjects)
dTrialPerms = [(nImgs+nNullsPerRep)*nRepsPerRun+(nRepsPerRun-1),nRuns];
SlotPerms = nan(dTrialPerms);
for iRun = 1:nRuns
P = repmat([nan(nNullsPerRep,1);(1:nImgs)'],1,nRepsPerRun);
P = mat2cell(P,nImgs+nNullsPerRep,ones(1,nRepsPerRun));
P = cellfun(@(v)v(randperm(numel(v))),P, ...
'UniformOutput',false);
P = cell2mat(P);
P = [P;-countStats(iRun,:)]; %#ok<AGROW> % Add counting task
P = P(:);
P = P(1:end-1); % Remove final counting task
SlotPerms(:,iRun) = P;
clear P;
end
return