Skip to content

Commit 8ce04f9

Browse files
committed
add shorter sound task code in expDesign
1 parent d6ae5bd commit 8ce04f9

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

setParameters.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
cfg.task.name = 'auditory localizer';
9292

9393
% Instruction
94-
cfg.task.instruction = '1-Detect the RED fixation cross\n \n\n';
94+
cfg.task.instruction = ['1 - Detect the RED fixation cross\n' ...
95+
'2 - Detected the shorter repeated sounds'];
9596

9697
% Fixation cross (in pixels)
9798
cfg.fixation.type = 'cross';
@@ -101,7 +102,7 @@
101102
cfg.fixation.lineWidthPix = 3;
102103
cfg.fixation.xDisplacement = 0;
103104
cfg.fixation.yDisplacement = 0;
104-
105+
105106
cfg.target.maxNbPerBlock = 2;
106107
cfg.target.duration = 0.5; % In secs
107108

@@ -151,7 +152,8 @@
151152

152153
cfg.mri.repetitionTime = 1.8;
153154

154-
cfg.bids.MRI.Instructions = 'Detect the RED fixation cross';
155+
cfg.bids.MRI.Instructions = ['1 - Detect the RED fixation cross\n' ...
156+
'2 - Detected the shorter repeated sounds'];
155157
cfg.bids.MRI.TaskDescription = [];
156158

157159
end

subfun/expDesign.m

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,17 @@
7676
while 1
7777

7878
fixationTargets = zeros(NB_BLOCKS, NB_EVENTS_PER_BLOCK);
79+
80+
soundTargets = zeros(NB_BLOCKS, NB_EVENTS_PER_BLOCK);
7981

8082
for iBlock = 1:NB_BLOCKS
8183

8284
% Set target
8385
% - if there are 2 targets per block we make sure that they are at least
8486
% 2 events apart
8587
% - targets cannot be on the first or last event of a block
86-
% - no more than 2 target in the same event order
8788

89+
% Fixation targets
8890
nbTarget = numTargetsForEachBlock(iBlock);
8991

9092
chosenPosition = setTargetPositionInSequence( ...
@@ -93,11 +95,21 @@
9395
[1 NB_EVENTS_PER_BLOCK]);
9496

9597
fixationTargets(iBlock, chosenPosition) = 1;
98+
99+
% Sound targets
100+
nbTarget = numTargetsForEachBlock(iBlock);
101+
102+
chosenPosition = setTargetPositionInSequence( ...
103+
NB_EVENTS_PER_BLOCK, ...
104+
nbTarget, ...
105+
[1 NB_EVENTS_PER_BLOCK]);
106+
107+
soundTargets(iBlock, chosenPosition) = 1;
96108

97109
end
98110

99-
% Check rule 3
100-
if max(sum(fixationTargets)) < NB_REPETITIONS - 1
111+
% Check that fixation and shorter sound are not presented in the same event
112+
if max(unique(fixationTargets + soundTargets)) < 2
101113
break
102114
end
103115

@@ -111,6 +123,8 @@
111123
cfg = setDirections(cfg);
112124

113125
cfg.design.fixationTargets = fixationTargets;
126+
127+
cfg.design.soundTargets = soundTargets;
114128

115129
%% Plot
116130
diplayDesign(cfg, displayFigs);

0 commit comments

Comments
 (0)