|
25 | 25 | % - ExpParameters.designBlockNames = cell array (nr_blocks, 1) with the |
26 | 26 | % name for each block |
27 | 27 | % |
28 | | - % - ExpParameters.designDirections = array (nr_blocks, numEventsPerBlock) |
| 28 | + % - ExpParameters.designDirections = array (nr_blocks, nbEventsPerBlock) |
29 | 29 | % with the direction to present in a given block |
30 | 30 | % - 0 90 180 270 indicate the angle |
31 | 31 | % - -1 indicates static |
32 | 32 | % |
33 | 33 | % |
34 | | - % - ExpParameters.designFixationTargets = array (nr_blocks, numEventsPerBlock) |
| 34 | + % - ExpParameters.designFixationTargets = array (nr_blocks, nbEventsPerBlock) |
35 | 35 | % showing for each event if it should be accompanied by a target |
36 | 36 | % |
37 | 37 |
|
|
49 | 49 | % Set variables here for a dummy test of this function |
50 | 50 | if nargin < 1 || isempty(cfg) |
51 | 51 | cfg.design.names = {'static', 'motion'}; |
52 | | - cfg.design.numRepetitions = 4; |
| 52 | + cfg.design.nbRepetitions = 4; |
53 | 53 | cfg.design.nbEventsPerBlock = 12; |
54 | 54 | cfg.target.maxNbPerBlock = 2; |
55 | 55 | end |
|
61 | 61 |
|
62 | 62 | % Get the parameters |
63 | 63 | 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; |
67 | 67 |
|
68 | | - if mod(numEventsPerBlock, length(motionDirections)) ~= 0 |
| 68 | + if mod(nbEventsPerBlock, length(motionDirections)) ~= 0 |
69 | 69 | warning('the n. of events per block is not a multiple of experimental conditions'); |
70 | 70 | end |
71 | 71 |
|
72 | 72 | %% Adapt some variables according to input |
73 | 73 |
|
74 | 74 | % 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)); |
77 | 77 |
|
78 | 78 | % Assign the conditions |
79 | | - condition = repmat(names, 1, numRepetitions); |
| 79 | + condition = repmat(names, 1, nbRepetitions); |
80 | 80 | nrBlocks = length(condition); |
81 | 81 | % Get the index of each condition |
82 | 82 | staticIndex = find(strcmp(condition, 'static')); |
83 | 83 | motionIndex = find(strcmp(condition, 'motion')); |
84 | 84 |
|
85 | 85 | % Assign the targets for each condition |
86 | | - rangeTargets = [1 maxNumFixTargPerBlock]; |
| 86 | + rangeTargets = [1 maxnbFixTargPerBlock]; |
87 | 87 | % Get random number of targets for one condition |
88 | | - targetPerCondition = randi(rangeTargets, 1, numRepetitions); |
| 88 | + targetPerCondition = randi(rangeTargets, 1, nbRepetitions); |
89 | 89 | % 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); |
93 | 93 |
|
94 | 94 | %% Give the blocks the names with condition |
95 | 95 |
|
96 | 96 | 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); |
99 | 99 |
|
100 | | - for iMotionBlock = 1:numRepetitions |
| 100 | + for iMotionBlock = 1:nbRepetitions |
101 | 101 |
|
102 | 102 | cfg.designDirections(motionIndex(iMotionBlock), :) = Shuffle(motionDirections); |
103 | 103 | cfg.designDirections(staticIndex(iMotionBlock), :) = Shuffle(staticDirections); |
|
122 | 122 |
|
123 | 123 | chosenTarget = []; |
124 | 124 |
|
125 | | - tmpTarget = numTargets(iBlock); |
| 125 | + tmpTarget = nbTargets(iBlock); |
126 | 126 |
|
127 | 127 | switch tmpTarget |
128 | 128 |
|
129 | 129 | case 1 |
130 | 130 |
|
131 | | - chosenTarget = randsample(2:numEventsPerBlock - 1, tmpTarget, false); |
| 131 | + chosenTarget = randsample(2:nbEventsPerBlock - 1, tmpTarget, false); |
132 | 132 |
|
133 | 133 | case 2 |
134 | 134 |
|
135 | 135 | targetDifference = 0; |
136 | 136 |
|
137 | 137 | while targetDifference <= 2 |
138 | | - chosenTarget = randsample(2:numEventsPerBlock - 1, tmpTarget, false); |
| 138 | + chosenTarget = randsample(2:nbEventsPerBlock - 1, tmpTarget, false); |
139 | 139 | targetDifference = (max(chosenTarget) - min(chosenTarget)); |
140 | 140 | end |
141 | 141 |
|
|
0 commit comments