forked from tsgouvea/TaskMatching
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdrawBlockLen.m
More file actions
19 lines (19 loc) · 1.14 KB
/
drawBlockLen.m
File metadata and controls
19 lines (19 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function BlockLen = drawBlockLen()
global TaskParameters BpodSystem
if TaskParameters.GUI.blockLenMax < TaskParameters.GUI.blockLenMin
TaskParameters.GUI.blockLenMax = TaskParameters.GUI.blockLenMax + TaskParameters.GUI.blockLenMin;
set(BpodSystem.GUIHandles.ParameterGUI.Params{strcmp(BpodSystem.GUIData.ParameterGUI.ParamNames,'blockLenMax')}, 'String', TaskParameters.GUI.blockLenMax);
warning('Bpod:Matching:blockLenMinMax','Minimum greater than maximum. Maximum interpreted as offset from minimum.')
end
BlockLen = 0;
iDraw = 0;
while BlockLen < TaskParameters.GUI.blockLenMin || BlockLen > TaskParameters.GUI.blockLenMax
BlockLen = ceil(exprnd(sqrt(TaskParameters.GUI.blockLenMin*TaskParameters.GUI.blockLenMax)));
iDraw = iDraw+1;
if iDraw > 1000
BlockLen = ceil(random('unif',TaskParameters.GUI.blockLenMin,TaskParameters.GUI.blockLenMax));
warning('Bpod:Matching:blockLenDraw',['Drawing block length from exponential distribution is taking too long.'...
'Using uniform distribution instead. If exponential is important for you, set reasonable minimum and maximum values and try again.'])
end
end
end