Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LNDG
Multi-Attribute-Task
Commits
db90d6c8
Commit
db90d6c8
authored
Apr 17, 2020
by
Julian Kosciessa
Browse files
final state MR version YA; timestamp 171024
parent
7793d825
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
A_preRandomizeTaskDataforMR_170927.m
0 → 100644
View file @
db90d6c8
%% initialize
if
ispc
pn
.
root
=
[
'D:'
,
filesep
,
'Dokumente und Einstellungen'
,
filesep
,
'guest'
,
filesep
,
'Desktop'
,
filesep
,
'StateSwitchMR'
,
filesep
,
'C_Paradigm'
,
filesep
];
else
disp
(
'Setup no supported.'
);
pn
.
root
=
[
'/Users/kosciessa/Desktop/StateSwitchMR/C_Paradigm/'
];
end
pn
.
CB
=
[
pn
.
root
,
'checker'
,
filesep
];
addpath
(
pn
.
CB
);
pn
.
MAT
=
[
pn
.
root
,
'dotsx'
,
filesep
];
addpath
(
pn
.
MAT
);
pn
.
SS
=
[
pn
.
root
,
'StateSwitch'
,
filesep
];
addpath
(
pn
.
SS
);
pn
.
Stroop
=
[
pn
.
root
,
'Stroop'
,
filesep
];
addpath
(
pn
.
Stroop
);
addpath
(
genpath
([
pn
.
root
,
'functions'
,
filesep
]));
addpath
(
genpath
([
pn
.
root
,
'helper'
,
filesep
]));
if
ispc
addpath
([
'C:'
,
filesep
,
'toolbox'
,
filesep
,
'Psychtoolbox'
]);
% PTB 3.0.11
else
addpath
(
genpath
(
'/Users/Shared/Psychtoolbox/'
));
% PTB 3.0.13 (160606)
end
if
ispc
Screen
(
'Preference'
,
'SkipSyncTests'
,
0
);
else
Screen
(
'Preference'
,
'SkipSyncTests'
,
1
);
oldLevel
=
Screen
(
'Preference'
,
'Verbosity'
,
4
);
% output debugging info
PsychDebugWindowConfiguration
(
0
,
0.3
)
end
%% pre-randomize data for MR experiment
for
ind1
=
1
:
2
for
ind2
=
1
:
3
for
ind3
=
1
:
99
if
numel
(
num2str
(
ind3
))
==
1
ind3_conv
=
[
'0'
,
num2str
(
ind3
)];
else
ind3_conv
=
num2str
(
ind3
);
end
ID
=
[
num2str
(
ind1
),
num2str
(
ind2
),
ind3_conv
];
disp
(
ID
);
% create randomization
expInfo
=
[];
expInfo
=
eval
([
'StateSwitch_createExpInfo_dynamic_170922'
]);
% save randomization
save
([
pn
.
root
,
'expInfo_MR/'
,
ID
,
'_expInfo.mat'
],
'expInfo'
);
end
end
end
% TO DO: indicate correct keys
\ No newline at end of file
StateSwitch/StateSwitch_addSurroundingCues_dynamic.m
deleted
100644 → 0
View file @
7793d825
function
StateSwitch_addSurroundingCues_dynamic
(
expInfo
,
screenInfo
,
indRun
,
indBlock
,
indTrial
)
% adds the surrounding cues for the next flip
for
indAtt
=
1
:
4
CueImg
=
[
'img'
,
filesep
,
expInfo
.
MAT
.
attNames
{
indAtt
},
'Q.png'
];
[
cueLoad
,
~
,
~
]
=
imread
(
CueImg
);
cue2Disp
=
Screen
(
'MakeTexture'
,
screenInfo
.
curWindow
,
cueLoad
);
smallIm
=
[
0
0
floor
(
size
(
cueLoad
,
2
)/
1.5
)
floor
(
size
(
cueLoad
,
1
)/
1.5
)];
switch
indAtt
case
1
smallIm
=
CenterRect
([
0
0
floor
(
size
(
cueLoad
,
2
)/
1.5
)
floor
(
size
(
cueLoad
,
1
)/
1.5
)],
[
0
0
screenInfo
.
screenRect
(
3
)/
2
screenInfo
.
screenRect
(
4
)/
2
]);
case
2
smallIm
=
CenterRect
([
0
0
floor
(
size
(
cueLoad
,
2
)/
1.5
)
floor
(
size
(
cueLoad
,
1
)/
1.5
)],
[
screenInfo
.
screenRect
(
3
)/
2
0
screenInfo
.
screenRect
(
3
)
screenInfo
.
screenRect
(
4
)/
2
]);
case
3
smallIm
=
CenterRect
([
0
0
floor
(
size
(
cueLoad
,
2
)/
1.5
)
floor
(
size
(
cueLoad
,
1
)/
1.5
)],
[
0
screenInfo
.
screenRect
(
4
)/
2
screenInfo
.
screenRect
(
3
)/
2
screenInfo
.
screenRect
(
4
)]);
case
4
smallIm
=
CenterRect
([
0
0
floor
(
size
(
cueLoad
,
2
)/
1.5
)
floor
(
size
(
cueLoad
,
1
)/
1.5
)],
[
screenInfo
.
screenRect
(
3
)/
2
screenInfo
.
screenRect
(
4
)/
2
screenInfo
.
screenRect
(
3
)
screenInfo
.
screenRect
(
4
)]);
end
if
ismember
(
indAtt
,
expInfo
.
AttCuesRun
{
indRun
}{
indBlock
,
indTrial
})
Screen
(
'DrawTexture'
,
screenInfo
.
curWindow
,
cue2Disp
,
[],
smallIm
);
% draw the object
end
end
end
\ No newline at end of file
StateSwitch/StateSwitch_addSurroundingCues_dynamic_170911.m
View file @
db90d6c8
...
@@ -10,7 +10,7 @@ function StateSwitch_addSurroundingCues_dynamic_170911(expInfo, screenInfo, indR
...
@@ -10,7 +10,7 @@ function StateSwitch_addSurroundingCues_dynamic_170911(expInfo, screenInfo, indR
[
cueLoad
,
~
,
~
]
=
imread
(
CueImg
);
[
cueLoad
,
~
,
~
]
=
imread
(
CueImg
);
cue2Disp
=
Screen
(
'MakeTexture'
,
screenInfo
.
curWindow
,
cueLoad
);
cue2Disp
=
Screen
(
'MakeTexture'
,
screenInfo
.
curWindow
,
cueLoad
);
posScale1
=
10
;
posScale1
=
10
;
posScale2
=
8
;
posScale2
=
7
;
% use 7 for MR, use 8 for EEG
smallIm
=
[
0
0
floor
(
posScale1
*
size
(
cueLoad
,
2
))
floor
(
posScale2
*
size
(
cueLoad
,
1
))];
smallIm
=
[
0
0
floor
(
posScale1
*
size
(
cueLoad
,
2
))
floor
(
posScale2
*
size
(
cueLoad
,
1
))];
x1
=
screenInfo
.
screenRect
(
3
);
x1
=
screenInfo
.
screenRect
(
3
);
x2
=
screenInfo
.
screenRect
(
4
);
x2
=
screenInfo
.
screenRect
(
4
);
...
...
StateSwitch/StateSwitch_addSurroundingCues_words.m
deleted
100644 → 0
View file @
7793d825
function
StateSwitch_addSurroundingCues_words
(
expInfo
,
screenInfo
,
indRun
,
indBlock
,
indTrial
)
% adds the surrounding cues for the next flip
% expInfo.Cues = {'Tier?'; 'einsilbig?'; 'gerade?'; 'H?'};
for
indAtt
=
1
:
4
switch
indAtt
case
1
smallIm
=
[
0
0
screenInfo
.
screenRect
(
3
)/
2
screenInfo
.
screenRect
(
4
)/
2
];
case
2
smallIm
=
[
screenInfo
.
screenRect
(
3
)/
2
0
screenInfo
.
screenRect
(
3
)
screenInfo
.
screenRect
(
4
)/
2
];
case
3
smallIm
=
[
0
screenInfo
.
screenRect
(
4
)/
2
screenInfo
.
screenRect
(
3
)/
2
screenInfo
.
screenRect
(
4
)];
case
4
smallIm
=
[
screenInfo
.
screenRect
(
3
)/
2
screenInfo
.
screenRect
(
4
)/
2
screenInfo
.
screenRect
(
3
)
screenInfo
.
screenRect
(
4
)];
end
if
ismember
(
indAtt
,
expInfo
.
AttCuesRun
{
indRun
}{
indBlock
,
indTrial
})
oldTextSize
=
Screen
(
'TextSize'
,
screenInfo
.
curWindow
,
30
);
DrawFormattedText
(
screenInfo
.
curWindow
,
expInfo
.
Cues
{
indAtt
},
'center'
,
'center'
,
[],
[],
[],[],[],[],
smallIm
);
Screen
(
'TextSize'
,
screenInfo
.
curWindow
,
oldTextSize
);
clear
oldTextSize
;
end
end
end
\ No newline at end of file
StateSwitch/StateSwitch_addSurroundingCues_words_171023.m
0 → 100644
View file @
db90d6c8
% 171023 | located the word cues centrally
function
StateSwitch_addSurroundingCues_words_171023
(
expInfo
,
screenInfo
,
indRun
,
indBlock
,
indTrial
)
% adds the surrounding cues for the next flip
% expInfo.Cues = {'Tier?'; 'einsilbig?'; 'gerade?'; 'H?'};
for
indAtt
=
1
:
4
posScale1
=
10
;
posScale2
=
7
;
% use 7 for MR, use 8 for EEG
x1
=
screenInfo
.
screenRect
(
3
);
x2
=
screenInfo
.
screenRect
(
4
);
coords
(
1
,:)
=
[
.
5
*
x1
-
(
1
/
posScale1
)
*
x1
,
.
5
*
x2
-
(
1
/
posScale2
)
*
x2
,
.
5
*
x1
,
.
5
*
x2
];
coords
(
2
,:)
=
[
.
5
*
x1
,
.
5
*
x2
-
(
1
/
posScale2
)
*
x2
,
.
5
*
x1
+
(
1
/
posScale1
)
*
x1
,
.
5
*
x2
];
coords
(
3
,:)
=
[
.
5
*
x1
-
(
1
/
posScale1
)
*
x1
,
.
5
*
x2
,
.
5
*
x1
,
.
5
*
x2
+
(
1
/
posScale2
)
*
x2
];
coords
(
4
,:)
=
[
.
5
*
x1
,
.
5
*
x2
,
.
5
*
x1
+
(
1
/
posScale1
)
*
x1
,
.
5
*
x2
+
(
1
/
posScale2
)
*
x2
];
% switch indAtt
% case 1
% smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], coords(1,:));
% case 2
% smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], coords(2,:));
% case 3
% smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], coords(3,:));
% case 4
% smallIm = CenterRect([0 0 floor(size(cueLoad,2)/1.5) floor(size(cueLoad,1)/1.5)], coords(4,:));
% end
if
ismember
(
indAtt
,
expInfo
.
AttCuesRun
{
indRun
}{
indBlock
,
indTrial
})
oldTextSize
=
Screen
(
'TextSize'
,
screenInfo
.
curWindow
,
30
);
DrawFormattedText
(
screenInfo
.
curWindow
,
expInfo
.
Cues
{
indAtt
},
'center'
,
'center'
,
[],
[],
[],[],[],[],
coords
(
indAtt
,:));
Screen
(
'TextSize'
,
screenInfo
.
curWindow
,
oldTextSize
);
clear
oldTextSize
;
end
end
end
\ No newline at end of file
StateSwitch/StateSwitch_createExpInfo_dynamic_170829.m
deleted
100644 → 0
View file @
7793d825
This diff is collapsed.
Click to expand it.
StateSwitch/StateSwitch_createExpInfo_dynamic_170911.m
deleted
100644 → 0
View file @
7793d825
This diff is collapsed.
Click to expand it.
StateSwitch/StateSwitch_createExpInfo_dynamic_TEST_170829.m
deleted
100644 → 0
View file @
7793d825
This diff is collapsed.
Click to expand it.
StateSwitch/StateSwitch_createExpInfo_dynamic_TEST_170911.m
deleted
100644 → 0
View file @
7793d825
This diff is collapsed.
Click to expand it.
StateSwitch/StateSwitch_createExpInfo_dynamic_TEST_17
0922
.m
→
StateSwitch/StateSwitch_createExpInfo_dynamic_TEST_17
1004
.m
View file @
db90d6c8
...
@@ -20,8 +20,9 @@
...
@@ -20,8 +20,9 @@
% 170823 - changed randomization to account for switch probability
% 170823 - changed randomization to account for switch probability
% 170829 - included RT feedback
% 170829 - included RT feedback
% 170911 - altered timing, added postcuefix
% 170911 - altered timing, added postcuefix
% 171004 - replaced repelem with version working on older MATLAB versions
function
expInfo
=
StateSwitch_createExpInfo_dynamic_TEST_17
0922
(
dim
)
function
expInfo
=
StateSwitch_createExpInfo_dynamic_TEST_17
1004
(
dim
)
expInfo
.
trialsPerAtt
=
16
;
% number of trials within state order & attribute (half of this for each choice)
expInfo
.
trialsPerAtt
=
16
;
% number of trials within state order & attribute (half of this for each choice)
expInfo
.
numOfAtt
=
4
;
% number of attributes to be included
expInfo
.
numOfAtt
=
4
;
% number of attributes to be included
...
@@ -299,7 +300,7 @@ function expInfo = StateSwitch_createExpInfo_dynamic_TEST_170922(dim)
...
@@ -299,7 +300,7 @@ function expInfo = StateSwitch_createExpInfo_dynamic_TEST_170922(dim)
if
ismember
(
indOrd
,
[
2
:
4
])
if
ismember
(
indOrd
,
[
2
:
4
])
for
indSplit
=
1
:
numel
(
Splits
)
for
indSplit
=
1
:
numel
(
Splits
)
check
=
0
;
check
=
0
;
while
check
==
0
% try to find pseudo-randomization that works
while
check
==
0
% try to find pseudo-randomization that works
try
try
% pseudo-randomize to start block with no-switch
% pseudo-randomize to start block with no-switch
% have a maximum of 3 repetitions (i.e. 4 identical trials)
% have a maximum of 3 repetitions (i.e. 4 identical trials)
...
@@ -316,14 +317,22 @@ function expInfo = StateSwitch_createExpInfo_dynamic_TEST_170922(dim)
...
@@ -316,14 +317,22 @@ function expInfo = StateSwitch_createExpInfo_dynamic_TEST_170922(dim)
end
end
% fill with attributes
% fill with attributes
if
indOrd
==
4
if
indOrd
==
4
availableOptions
=
repelem
([
1
:
4
],
4.
*
extractMat
(
indSplit
,:));
A
=
1
:
4
;
R
=
4.
*
extractMat
(
indSplit
,:);
availableOptions
=
cell2mat
(
arrayfun
(
@
(
a
,
r
)
repmat
(
a
,
1
,
r
),
A
,
R
,
'uni'
,
0
));
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
mostCommon
(
1
);
mostCommon
=
mostCommon
(
1
);
elseif
indOrd
==
3
elseif
indOrd
==
3
availableOptions
=
repelem
([
1
:
4
],
4.
*
extractMat
(
indSplit
,:));
A
=
1
:
4
;
R
=
4.
*
extractMat
(
indSplit
,:);
availableOptions
=
cell2mat
(
arrayfun
(
@
(
a
,
r
)
repmat
(
a
,
1
,
r
),
A
,
R
,
'uni'
,
0
));
%availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
2
);
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
2
);
elseif
indOrd
==
2
elseif
indOrd
==
2
availableOptions
=
repelem
([
1
:
4
],
numel
(
Splits
{
indSplit
})/
2.
*
extractMat
(
indSplit
,:));
A
=
1
:
4
;
R
=
numel
(
Splits
{
indSplit
})/
2.
*
extractMat
(
indSplit
,:);
availableOptions
=
cell2mat
(
arrayfun
(
@
(
a
,
r
)
repmat
(
a
,
1
,
r
),
A
,
R
,
'uni'
,
0
));
%availableOptions = repelem([1:4], numel(Splits{indSplit})/2.*extractMat(indSplit,:));
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
mostCommon
(
1
);
mostCommon
=
mostCommon
(
1
);
end
end
...
...
StateSwitch/StateSwitch_createExpInfo_words_17
0829
.m
→
StateSwitch/StateSwitch_createExpInfo_words_17
1023
.m
View file @
db90d6c8
...
@@ -16,8 +16,9 @@
...
@@ -16,8 +16,9 @@
% 170816 - created word randomization version, deleted dot entries
% 170816 - created word randomization version, deleted dot entries
% 170823 - changed randomization to account for switch probability
% 170823 - changed randomization to account for switch probability
% 170829 - included RT feedback
% 170829 - included RT feedback
% 171023 - replaced repelem with version working on older MATLAB versions
function
expInfo
=
StateSwitch_createExpInfo_words_17
0829
(
varargin
)
function
expInfo
=
StateSwitch_createExpInfo_words_17
1023
(
varargin
)
% load wordlists
% load wordlists
try
try
...
@@ -32,14 +33,14 @@ function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
...
@@ -32,14 +33,14 @@ function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
expInfo
.
totalTrials
=
expInfo
.
trialsPerAtt
*
expInfo
.
numOfAtt
*
expInfo
.
numOrders
;
expInfo
.
totalTrials
=
expInfo
.
trialsPerAtt
*
expInfo
.
numOfAtt
*
expInfo
.
numOrders
;
expInfo
.
durBlockOnset
=
5
;
% duration of block onset
expInfo
.
durBlockOnset
=
5
;
% duration of block onset
expInfo
.
durFixCue
=
3
;
% duration of fixcross with cues
expInfo
.
durFixCue
=
3
.5
;
% duration of fixcross with cues
expInfo
.
durCue
=
0
;
% duration of cue
expInfo
.
durCue
=
1
;
% duration of cue
expInfo
.
durPres
=
2
;
% duration of presentation
expInfo
.
durPres
=
2
.5
;
% duration of presentation
expInfo
.
durResp
=
0
;
% duration of question
expInfo
.
durResp
=
0
;
% duration of question
expInfo
.
durConf
=
0
;
% duration of confidence
expInfo
.
durConf
=
0
;
% duration of confidence
expInfo
.
durReward
=
3
;
% duration of reward
expInfo
.
durReward
=
3
;
% duration of reward
expInfo
.
durITI
=
2
;
% duration of ITI
expInfo
.
durITI
=
2
;
% duration of ITI
expInfo
.
CTsim
=
'
yes
'
;
% simultaneous presentation of cue + target? Note: If 'yes', set expInfo.durCue to 0.
expInfo
.
CTsim
=
'
no
'
;
% simultaneous presentation of cue + target? Note: If 'yes', set expInfo.durCue to 0.
%expInfo.timing = 'absolute'; % use absolute timing with reference to run onset? alternative: 'relative'
%expInfo.timing = 'absolute'; % use absolute timing with reference to run onset? alternative: 'relative'
%expInfo.timing = 'relative';
%expInfo.timing = 'relative';
...
@@ -84,31 +85,20 @@ function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
...
@@ -84,31 +85,20 @@ function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
%% specify keys
%% specify keys
% Use OS X keyboard naming scheme across all plattforms
% Use OS X keyboard naming scheme across all plattforms
% Otherwise LeftControl/RightControl are not recognized
% Otherwise LeftControl/RightControl are not recognized
KbName
(
'UnifyKeyNames'
);
KbName
(
'UnifyKeyNames'
);
expInfo
.
keyLeft
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftAlt'
),
KbName
(
'LeftArrow'
),
KbName
(
'1!'
),
KbName
(
'2@'
),
KbName
(
'b'
),
KbName
(
'z'
)];
% left response
if
ismac
% Mac keyboard
expInfo
.
keyRight
=
[
KbName
(
'RightControl'
),
KbName
(
'RightAlt'
),
KbName
(
'RightArrow'
),
KbName
(
'6^'
),
KbName
(
'7&'
),
KbName
(
'g'
),
KbName
(
'r'
)];
% right response
expInfo
.
keyLeft
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftAlt'
),
KbName
(
'LeftArrow'
)];
% left response
expInfo
.
keyConf1
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftArrow'
),
KbName
(
'1!'
),
KbName
(
'b'
)];
% lowest confidence
expInfo
.
keyRight
=
[
KbName
(
'RightControl'
),
KbName
(
'RightAlt'
),
KbName
(
'RightArrow'
)];
% right response
expInfo
.
keyConf2
=
[
KbName
(
'LeftAlt'
),
KbName
(
'2@'
),
KbName
(
'z'
)];
% intermediate confidence low
expInfo
.
keyConf1
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftArrow'
)];
% lowest confidence
expInfo
.
keyConf3
=
[
KbName
(
'RightAlt'
),
KbName
(
'6^'
),
KbName
(
'g'
)];
% intermediate confidence high
expInfo
.
keyConf2
=
KbName
(
'LeftAlt'
);
% intermediate confidence low
expInfo
.
keyConf4
=
[
KbName
(
'RightControl'
),
KbName
(
'RightArrow'
),
KbName
(
'7&'
),
KbName
(
'r'
)];
% highest confidence
expInfo
.
keyConf3
=
KbName
(
'RightAlt'
);
% intermediate confidence high
expInfo
.
keyConf4
=
[
KbName
(
'RightControl'
),
KbName
(
'RightArrow'
)];
% highest confidence
else
% PC keyboard
% expInfo.keyLeft = KbName('LeftControl');
% expInfo.keyRight = KbName('RightControl');
expInfo
.
keyLeft
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftAlt'
),
KbName
(
'LeftArrow'
)];
expInfo
.
keyRight
=
[
KbName
(
'RightControl'
),
KbName
(
'RightAlt'
),
KbName
(
'RightArrow'
)];
expInfo
.
keyConf1
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftArrow'
)];
expInfo
.
keyConf2
=
KbName
(
'LeftAlt'
);
expInfo
.
keyConf3
=
KbName
(
'RightAlt'
);
expInfo
.
keyConf4
=
[
KbName
(
'RightControl'
),
KbName
(
'RightArrow'
)];
end
expInfo
.
keyModifier
=
KbName
(
'LeftAlt'
);
% to prevent accidental input
expInfo
.
keyModifier
=
KbName
(
'LeftAlt'
);
% to prevent accidental input
expInfo
.
keyEscape
=
KbName
(
'Escape'
);
%
expInfo
.
keyEscape
=
KbName
(
'Escape'
);
%
expInfo
.
keyReturn
=
KbName
(
'Return'
);
% continue experiment
expInfo
.
keyReturn
=
[
KbName
(
'Return'
),
KbName
(
'7&'
),
KbName
(
'g'
),
KbName
(
'r'
)];
% continue experiment
expInfo
.
keyPause
=
KbName
(
'p'
);
expInfo
.
keyPause
=
KbName
(
'p'
);
% g,r - left; b,z- right (blue does not work)
%% randomize stimuli and non-target duration
%% randomize stimuli and non-target duration
...
@@ -269,14 +259,22 @@ function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
...
@@ -269,14 +259,22 @@ function expInfo = StateSwitch_createExpInfo_words_170829(varargin)
end
end
% fill with attributes
% fill with attributes
if
indOrd
==
4
if
indOrd
==
4
availableOptions
=
repelem
([
1
:
4
],
4.
*
extractMat
(
indSplit
,:));
A
=
1
:
4
;
R
=
4.
*
extractMat
(
indSplit
,:);
availableOptions
=
cell2mat
(
arrayfun
(
@
(
a
,
r
)
repmat
(
a
,
1
,
r
),
A
,
R
,
'uni'
,
0
));
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
mostCommon
(
1
);
mostCommon
=
mostCommon
(
1
);
elseif
indOrd
==
3
elseif
indOrd
==
3
availableOptions
=
repelem
([
1
:
4
],
4.
*
extractMat
(
indSplit
,:));
A
=
1
:
4
;
R
=
4.
*
extractMat
(
indSplit
,:);
availableOptions
=
cell2mat
(
arrayfun
(
@
(
a
,
r
)
repmat
(
a
,
1
,
r
),
A
,
R
,
'uni'
,
0
));
%availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
2
);
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
2
);
elseif
indOrd
==
2
elseif
indOrd
==
2
availableOptions
=
repelem
([
1
:
4
],
numel
(
Splits
{
indSplit
})/
2.
*
extractMat
(
indSplit
,:));
A
=
1
:
4
;
R
=
numel
(
Splits
{
indSplit
})/
2.
*
extractMat
(
indSplit
,:);
availableOptions
=
cell2mat
(
arrayfun
(
@
(
a
,
r
)
repmat
(
a
,
1
,
r
),
A
,
R
,
'uni'
,
0
));
%availableOptions = repelem([1:4], numel(Splits{indSplit})/2.*extractMat(indSplit,:));
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
mostCommon
(
1
);
mostCommon
=
mostCommon
(
1
);
end
end
...
...
StateSwitch/StateSwitch_createExpInfo_words_TEST_17
0829
.m
→
StateSwitch/StateSwitch_createExpInfo_words_TEST_17
1023
.m
View file @
db90d6c8
...
@@ -17,12 +17,14 @@
...
@@ -17,12 +17,14 @@
% 170821 - created practice version
% 170821 - created practice version
% 170823 - changed randomization to account for switch probability
% 170823 - changed randomization to account for switch probability
% 170829 - included RT feedback
% 170829 - included RT feedback
% 171023 - replaced repelem with version working on older MATLAB versions
% - draw stimuli from separate practice set
function
expInfo
=
StateSwitch_createExpInfo_words_TEST_17
0829
(
dim
)
function
expInfo
=
StateSwitch_createExpInfo_words_TEST_17
1023
(
dim
)
% load wordlists
% load wordlists
try
try
load
(
'stimuliSelected.mat'
)
load
(
'stimuliSelected
_practice
.mat'
)
catch
catch
warning
(
'Stimuli not found, please check path.'
)
warning
(
'Stimuli not found, please check path.'
)
end
end
...
@@ -33,14 +35,14 @@ function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
...
@@ -33,14 +35,14 @@ function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
expInfo
.
totalTrials
=
expInfo
.
trialsPerAtt
*
expInfo
.
numOfAtt
*
expInfo
.
numOrders
;
expInfo
.
totalTrials
=
expInfo
.
trialsPerAtt
*
expInfo
.
numOfAtt
*
expInfo
.
numOrders
;
expInfo
.
durBlockOnset
=
5
;
% duration of block onset
expInfo
.
durBlockOnset
=
5
;
% duration of block onset
expInfo
.
durFixCue
=
3
;
% duration of fixcross with cues
expInfo
.
durFixCue
=
3
.5
;
% duration of fixcross with cues
expInfo
.
durCue
=
0
;
% duration of cue
expInfo
.
durCue
=
1
;
% duration of cue
expInfo
.
durPres
=
2
;
% duration of presentation
expInfo
.
durPres
=
2
.5
;
% duration of presentation
expInfo
.
durResp
=
0
;
% duration of question
expInfo
.
durResp
=
0
;
% duration of question
expInfo
.
durConf
=
0
;
% duration of confidence
expInfo
.
durConf
=
0
;
% duration of confidence
expInfo
.
durReward
=
0
;
% duration of reward
expInfo
.
durReward
=
3
;
% duration of reward
expInfo
.
durITI
=
2
;
% duration of ITI
expInfo
.
durITI
=
2
;
% duration of ITI
expInfo
.
CTsim
=
'
yes'
;
expInfo
.
CTsim
=
'
no'
;
% simultaneous presentation of cue + target? Note: If 'yes', set expInfo.durCue to 0.
%expInfo.timing = 'absolute'; % use absolute timing with reference to run onset? alternative: 'relative'
%expInfo.timing = 'absolute'; % use absolute timing with reference to run onset? alternative: 'relative'
%expInfo.timing = 'relative';
%expInfo.timing = 'relative';
...
@@ -77,16 +79,18 @@ function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
...
@@ -77,16 +79,18 @@ function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
% Use OS X keyboard naming scheme across all plattforms
% Use OS X keyboard naming scheme across all plattforms
% Otherwise LeftControl/RightControl are not recognized
% Otherwise LeftControl/RightControl are not recognized
KbName
(
'UnifyKeyNames'
);
KbName
(
'UnifyKeyNames'
);
expInfo
.
keyLeft
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftAlt'
),
KbName
(
'LeftArrow'
),
KbName
(
'1!'
),
KbName
(
'2@'
)];
% left response
expInfo
.
keyLeft
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftAlt'
),
KbName
(
'LeftArrow'
),
KbName
(
'1!'
),
KbName
(
'2@'
)
,
KbName
(
'b'
),
KbName
(
'z'
)
];
% left response
expInfo
.
keyRight
=
[
KbName
(
'RightControl'
),
KbName
(
'RightAlt'
),
KbName
(
'RightArrow'
),
KbName
(
'6^'
),
KbName
(
'7&'
)];
% right response
expInfo
.
keyRight
=
[
KbName
(
'RightControl'
),
KbName
(
'RightAlt'
),
KbName
(
'RightArrow'
),
KbName
(
'6^'
),
KbName
(
'7&'
)
,
KbName
(
'g'
),
KbName
(
'r'
)
];
% right response
expInfo
.
keyConf1
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftArrow'
),
KbName
(
'1!'
)];
% lowest confidence
expInfo
.
keyConf1
=
[
KbName
(
'LeftControl'
),
KbName
(
'LeftArrow'
),
KbName
(
'1!'
)
,
KbName
(
'b'
)
];
% lowest confidence
expInfo
.
keyConf2
=
[
KbName
(
'LeftAlt'
),
KbName
(
'2@'
)];
% intermediate confidence low
expInfo
.
keyConf2
=
[
KbName
(
'LeftAlt'
),
KbName
(
'2@'
)
,
KbName
(
'z'
)
];
% intermediate confidence low
expInfo
.
keyConf3
=
[
KbName
(
'RightAlt'
),
KbName
(
'6^'
)];
% intermediate confidence high
expInfo
.
keyConf3
=
[
KbName
(
'RightAlt'
),
KbName
(
'6^'
)
,
KbName
(
'g'
)
];
% intermediate confidence high
expInfo
.
keyConf4
=
[
KbName
(
'RightControl'
),
KbName
(
'RightArrow'
),
KbName
(
'7&'
)];
% highest confidence
expInfo
.
keyConf4
=
[
KbName
(
'RightControl'
),
KbName
(
'RightArrow'
),
KbName
(
'7&'
)
,
KbName
(
'r'
)
];
% highest confidence
expInfo
.
keyModifier
=
KbName
(
'LeftAlt'
);
% to prevent accidental input
expInfo
.
keyModifier
=
KbName
(
'LeftAlt'
);
% to prevent accidental input
expInfo
.
keyEscape
=
KbName
(
'Escape'
);
%
expInfo
.
keyEscape
=
KbName
(
'Escape'
);
%
expInfo
.
keyReturn
=
[
KbName
(
'Return'
),
KbName
(
'7&'
)];
% continue experiment
expInfo
.
keyReturn
=
[
KbName
(
'Return'
),
KbName
(
'7&'
)
,
KbName
(
'g'
),
KbName
(
'r'
)
];
% continue experiment
expInfo
.
keyPause
=
KbName
(
'p'
);
expInfo
.
keyPause
=
KbName
(
'p'
);
% g,r - left; b,z- right (blue does not work)
%% randomize stimuli and non-target duration
%% randomize stimuli and non-target duration
...
@@ -247,14 +251,22 @@ function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
...
@@ -247,14 +251,22 @@ function expInfo = StateSwitch_createExpInfo_words_TEST_170829(dim)
end
end
% fill with attributes
% fill with attributes
if
indOrd
==
4
if
indOrd
==
4
availableOptions
=
repelem
([
1
:
4
],
4.
*
extractMat
(
indSplit
,:));
A
=
1
:
4
;
R
=
4.
*
extractMat
(
indSplit
,:);
availableOptions
=
cell2mat
(
arrayfun
(
@
(
a
,
r
)
repmat
(
a
,
1
,
r
),
A
,
R
,
'uni'
,
0
));
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
mostCommon
(
1
);
mostCommon
=
mostCommon
(
1
);
elseif
indOrd
==
3
elseif
indOrd
==
3
availableOptions
=
repelem
([
1
:
4
],
4.
*
extractMat
(
indSplit
,:));
A
=
1
:
4
;
R
=
4.
*
extractMat
(
indSplit
,:);
availableOptions
=
cell2mat
(
arrayfun
(
@
(
a
,
r
)
repmat
(
a
,
1
,
r
),
A
,
R
,
'uni'
,
0
));
%availableOptions = repelem([1:4], 4.*extractMat(indSplit,:));
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
2
);
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
2
);
elseif
indOrd
==
2
elseif
indOrd
==
2
availableOptions
=
repelem
([
1
:
4
],
numel
(
Splits
{
indSplit
})/
2.
*
extractMat
(
indSplit
,:));
A
=
1
:
4
;
R
=
numel
(
Splits
{
indSplit
})/
2.
*
extractMat
(
indSplit
,:);
availableOptions
=
cell2mat
(
arrayfun
(
@
(
a
,
r
)
repmat
(
a
,
1
,
r
),
A
,
R
,
'uni'
,
0
));
%availableOptions = repelem([1:4], numel(Splits{indSplit})/2.*extractMat(indSplit,:));
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
find
(
extractMat
(
indSplit
,:)
==
1
);
mostCommon
=
mostCommon
(
1
);
mostCommon
=
mostCommon
(
1
);
end
end
...
...
StateSwitch/StateSwitch_experiment_170829.m
deleted
100644 → 0
View file @
7793d825
This diff is collapsed.
Click to expand it.
StateSwitch/StateSwitch_experiment_170908.m
deleted
100644 → 0
View file @
7793d825
This diff is collapsed.
Click to expand it.
StateSwitch/StateSwitch_experiment_17
0911
.m
→
StateSwitch/StateSwitch_experiment_17
1023
.m
View file @
db90d6c8
...
@@ -19,8 +19,9 @@
...
@@ -19,8 +19,9 @@
% 170814 | added triggers (MR, EEG, ET); turned into run version
% 170814 | added triggers (MR, EEG, ET); turned into run version
% 170816 | adapted to multiple task variants
% 170816 | adapted to multiple task variants
% 170816 | included RT feedback + reward at end of each block
% 170816 | included RT feedback + reward at end of each block
% 171023 | removed peripheral word cues during presentation
function
StateSwitch_experiment_17
0911
(
expInfo
,
setup
)
function
StateSwitch_experiment_17
1023
(
expInfo
,
setup
)
%%
%%
%% sanitize function parameters
%% sanitize function parameters
...
@@ -65,9 +66,21 @@ function StateSwitch_experiment_170911(expInfo, setup)
...
@@ -65,9 +66,21 @@ function StateSwitch_experiment_170911(expInfo, setup)
end
end
end
end
if
setup
.
MR
.
useMR
==
1
textSizeLow
=
15
;
textSizeHigh
=
30
;
else
textSizeLow
=
30
;
textSizeHigh
=
30
;
end
%% set behavioural data savepath
%% set behavioural data savepath
sessionFile
=
[
setup
.
subjectsPath
,
setup
.
subj
,
'_StateSwitch_'
,
setup
.
task
,
'_'
,
datestr
(
now
,
'yymmdd_HHMM'
),
'.mat'
];
if
setup
.
MR
.
useMR
==
1
sessionFile
=
[
setup
.
subjectsPath
,
setup
.
subj
,
'_StateSwitchMR_'
,
setup
.
task
,
'_'
,
datestr
(
now
,
'yymmdd_HHMM'
),
'.mat'
];
else
sessionFile
=
[
setup
.
subjectsPath
,
setup
.
subj
,
'_StateSwitch_'
,
setup
.
task
,
'_'
,
datestr
(
now
,
'yymmdd_HHMM'
),
'.mat'
];
end
%% set up PTB
%% set up PTB
...
@@ -92,7 +105,7 @@ function StateSwitch_experiment_170911(expInfo, setup)
...
@@ -92,7 +105,7 @@ function StateSwitch_experiment_170911(expInfo, setup)
HideCursor
(
screenInfo
.
curWindow
);
HideCursor
(
screenInfo
.
curWindow
);
end
end
Screen
(
'TextFont'
,
screenInfo
.
curWindow
,
'Helvetica'
);
Screen
(
'TextFont'
,
screenInfo
.
curWindow
,
'Helvetica'
);
Screen
(
'TextSize'
,
screenInfo
.
curWindow
,
20
);
Screen
(
'TextSize'
,
screenInfo
.
curWindow
,
textSizeLow
);
Screen
(
'TextStyle'
,
screenInfo
.
curWindow
,
0
);
% regular
Screen
(
'TextStyle'
,
screenInfo
.
curWindow
,
0
);
% regular
Screen
(
'TextColor'
,
screenInfo
.
curWindow
,
255
);
% white
Screen
(
'TextColor'
,
screenInfo
.
curWindow
,
255
);
% white
ifi
=
Screen
(
'GetFlipInterval'
,
screenInfo
.
curWindow
);
% Query the frame duration
ifi
=
Screen
(
'GetFlipInterval'
,
screenInfo
.
curWindow
);
% Query the frame duration
...
@@ -107,13 +120,14 @@ function StateSwitch_experiment_170911(expInfo, setup)
...
@@ -107,13 +120,14 @@ function StateSwitch_experiment_170911(expInfo, setup)
screenInfo
.
keyboard_exp
=
max
(
keyboardIndices
);
screenInfo
.
keyboard_exp
=
max
(
keyboardIndices
);
else
disp
(
'Check setup: only 1 or 2 keyboards supported.'
);
else
disp
(
'Check setup: only 1 or 2 keyboards supported.'
);
end
end
ListenChar
(
2
);
% Do dummy calls to GetSecs, WaitSecs, KbCheck(-1) to make sure
% Do dummy calls to GetSecs, WaitSecs, KbCheck(-1) to make sure
% they are loaded and ready when we need them - without delays
% they are loaded and ready when we need them - without delays
% in the wrong moment:
% in the wrong moment:
%
KbCheck(-1);
KbCheck
(
-
1
);
%
WaitSecs(0.1);
WaitSecs
(
0.1
);
%
GetSecs;
GetSecs
;
%% startup ET
%% startup ET
...
@@ -138,12 +152,12 @@ function StateSwitch_experiment_170911(expInfo, setup)
...
@@ -138,12 +152,12 @@ function StateSwitch_experiment_170911(expInfo, setup)
%% run loop
%% run loop
for
indRun
=
1
:
expInfo
.
runAmount
for
indRun
=
setup
.
StartRunOn
:
expInfo
.
runAmount
if
setup
.
ET
.
useET
if
setup
.
ET
.
useET
Screen
(
'TextSize'
,
screenInfo
.
curWindow
,
20
);
Screen
(
'TextSize'
,
screenInfo
.
curWindow
,
textSizeLow
);
DrawFormattedText
(
screenInfo
.
curWindow
,
...