Skip to content

Commit ba0d4fe

Browse files
committed
fix num to nb
1 parent 4e517c0 commit ba0d4fe

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

subfun/expDesign.m

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
% - ExpParameters.designBlockNames = cell array (nr_blocks, 1) with the
2626
% name for each block
2727
%
28-
% - ExpParameters.designDirections = array (nr_blocks, numEventsPerBlock)
28+
% - ExpParameters.designDirections = array (nr_blocks, nbEventsPerBlock)
2929
% with the direction to present in a given block
3030
% - 0 90 180 270 indicate the angle
3131
% - -1 indicates static
3232
%
3333
%
34-
% - ExpParameters.designFixationTargets = array (nr_blocks, numEventsPerBlock)
34+
% - ExpParameters.designFixationTargets = array (nr_blocks, nbEventsPerBlock)
3535
% showing for each event if it should be accompanied by a target
3636
%
3737

@@ -49,7 +49,7 @@
4949
% Set variables here for a dummy test of this function
5050
if nargin < 1 || isempty(cfg)
5151
cfg.design.names = {'static', 'motion'};
52-
cfg.design.numRepetitions = 4;
52+
cfg.design.nbRepetitions = 4;
5353
cfg.design.nbEventsPerBlock = 12;
5454
cfg.target.maxNbPerBlock = 2;
5555
end
@@ -61,43 +61,43 @@
6161

6262
% Get the parameters
6363
names = cfg.design.names;
64-
numRepetitions = cfg.design.nbRepetitions;
65-
numEventsPerBlock = cfg.design.nbEventsPerBlock;
66-
maxNumFixTargPerBlock = cfg.target.maxNbPerBlock;
64+
nbRepetitions = cfg.design.nbRepetitions;
65+
nbEventsPerBlock = cfg.design.nbEventsPerBlock;
66+
maxNbFixTargPerBlock = cfg.target.maxNbPerBlock;
6767

68-
if mod(numEventsPerBlock, length(motionDirections)) ~= 0
68+
if mod(nbEventsPerBlock, length(motionDirections)) ~= 0
6969
warning('the n. of events per block is not a multiple of experimental conditions');
7070
end
7171

7272
%% Adapt some variables according to input
7373

7474
% Set directions for static and motion condition
75-
motionDirections = repmat(motionDirections, 1, numEventsPerBlock / length(motionDirections));
76-
staticDirections = repmat(staticDirections, 1, numEventsPerBlock / length(staticDirections));
75+
motionDirections = repmat(motionDirections, 1, nbEventsPerBlock / length(motionDirections));
76+
staticDirections = repmat(staticDirections, 1, nbEventsPerBlock / length(staticDirections));
7777

7878
% Assign the conditions
79-
condition = repmat(names, 1, numRepetitions);
79+
condition = repmat(names, 1, nbRepetitions);
8080
nrBlocks = length(condition);
8181
% Get the index of each condition
8282
staticIndex = find(strcmp(condition, 'static'));
8383
motionIndex = find(strcmp(condition, 'motion'));
8484

8585
% Assign the targets for each condition
86-
rangeTargets = [1 maxNumFixTargPerBlock];
86+
rangeTargets = [1 maxnbFixTargPerBlock];
8787
% Get random number of targets for one condition
88-
targetPerCondition = randi(rangeTargets, 1, numRepetitions);
88+
targetPerCondition = randi(rangeTargets, 1, nbRepetitions);
8989
% Assign the number of targets for each condition after shuffling
90-
numTargets = zeros(1, nrBlocks);
91-
numTargets(staticIndex) = Shuffle(targetPerCondition);
92-
numTargets(motionIndex) = Shuffle(targetPerCondition);
90+
nbTargets = zeros(1, nrBlocks);
91+
nbTargets(staticIndex) = Shuffle(targetPerCondition);
92+
nbTargets(motionIndex) = Shuffle(targetPerCondition);
9393

9494
%% Give the blocks the names with condition
9595

9696
cfg.designBlockNames = cell(nrBlocks, 1);
97-
cfg.designDirections = zeros(nrBlocks, numEventsPerBlock);
98-
cfg.designFixationTargets = zeros(nrBlocks, numEventsPerBlock);
97+
cfg.designDirections = zeros(nrBlocks, nbEventsPerBlock);
98+
cfg.designFixationTargets = zeros(nrBlocks, nbEventsPerBlock);
9999

100-
for iMotionBlock = 1:numRepetitions
100+
for iMotionBlock = 1:nbRepetitions
101101

102102
cfg.designDirections(motionIndex(iMotionBlock), :) = Shuffle(motionDirections);
103103
cfg.designDirections(staticIndex(iMotionBlock), :) = Shuffle(staticDirections);
@@ -122,20 +122,20 @@
122122

123123
chosenTarget = [];
124124

125-
tmpTarget = numTargets(iBlock);
125+
tmpTarget = nbTargets(iBlock);
126126

127127
switch tmpTarget
128128

129129
case 1
130130

131-
chosenTarget = randsample(2:numEventsPerBlock - 1, tmpTarget, false);
131+
chosenTarget = randsample(2:nbEventsPerBlock - 1, tmpTarget, false);
132132

133133
case 2
134134

135135
targetDifference = 0;
136136

137137
while targetDifference <= 2
138-
chosenTarget = randsample(2:numEventsPerBlock - 1, tmpTarget, false);
138+
chosenTarget = randsample(2:nbEventsPerBlock - 1, tmpTarget, false);
139139
targetDifference = (max(chosenTarget) - min(chosenTarget));
140140
end
141141

0 commit comments

Comments
 (0)