-
Notifications
You must be signed in to change notification settings - Fork 2
/
at_RDKHoopMatrix_psyAud.m
76 lines (55 loc) · 1.69 KB
/
at_RDKHoopMatrix_psyAud.m
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
function MAT=at_RDKHoopMatrix_psyAud(catchtrials, audtrials, audInfo)
%% fill single columns
%condition definitions
% variable names: 1. modlaity (a, v, av), 2. direction (l:left; u:up),
% 3.coherence (l:low, m:middle, h:high or ordianl number codes)
% matrix values: auditory direction, auditory coherence, visual direction,
% visual coherence
% catch trials
catchs=[0 0];
% stimulus [direction coherencelevel]
al1=[2 1];
ar1=[1 1];
al2=[2 2];
ar2=[1 2];
al3=[2 3];
ar3=[1 3];
al4=[2 4];
ar4=[1 4];
al5=[2 5];
ar5=[1 5];
al6=[2 6];
ar6=[1 6];
al7=[2 7];
ar7=[1 7];
%% create Matrices
%catch trials
catchmat=repmat(catchs, catchtrials, 1);
% auditory
matal1=repmat(al1, audtrials, 1);
matar1=repmat(ar1, audtrials, 1);
matal2=repmat(al2, audtrials, 1);
matar2=repmat(ar2, audtrials, 1);
matal3=repmat(al3, audtrials, 1);
matar3=repmat(ar3, audtrials, 1);
matal4=repmat(al4, audtrials, 1);
matar4=repmat(ar4, audtrials, 1);
matal5=repmat(al5, audtrials, 1);
matar5=repmat(ar5, audtrials, 1);
matal6=repmat(al6, audtrials, 1);
matar6=repmat(ar6, audtrials, 1);
matal7=repmat(al7, audtrials, 1);
matar7=repmat(ar7, audtrials, 1);
%concatenate all conditions into 1 big matrix
trialStruc= cat(1, catchmat, matal1, matar1, matal2, matar2, matal3, matar3, matal4, matar4, matal5, matar5, matal6, matar6, matal7, matar7);
%% define single columns
% add trial order and response recording columns
nbtrials=size(trialStruc(:,1));
resp=zeros(nbtrials(1), 1); % will be randomized
rt=zeros(nbtrials(1), 1); % will be randomized
keys=zeros(nbtrials(1), 1);
%% create trial structure
rng('shuffle');
order=randperm(nbtrials(1)); %new trial order
trialOrder=trialStruc(order, :);
MAT=cat(2, trialOrder, resp, rt, keys);