-
Notifications
You must be signed in to change notification settings - Fork 4
/
LBA_parse.m
76 lines (69 loc) · 1.47 KB
/
LBA_parse.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
function [v A b sv t0] = LBA_parse(model, pArray, Ncond)
% Parse parameter vector for fitting LBA
%
% SF 2012
%% Parse pArray vector and setup some transformations
j=1;
err = 0;
if model.v == 1
v = repmat(pArray(j), Ncond, 1);
j=j+1;
elseif model.v == Ncond
for c = 1:model.v
v(c,:) = pArray(j);
j=j+1;
end
else err = 1;
end
if model.A == 1
A = repmat(pArray(j), Ncond, 1);
j=j+1;
elseif model.A == Ncond
for c = 1:model.A
A(c,:) = pArray(j);
j=j+1;
end
else err = 1;
end
if model.b == 1
b = repmat(pArray(j), Ncond, 1);
j=j+1;
elseif model.b == Ncond
for c = 1:model.b
b(c,:) = pArray(j);
j=j+1;
end
else err = 1;
end
if model.sv == 1
sv = repmat(pArray(j), Ncond, 1);
j=j+1;
elseif model.sv == Ncond
for c = 1:model.sv
sv(c,:) = pArray(j);
j=j+1;
end
else err = 1;
end
if length(pArray) >= j
if model.t0 == 1
t0 = repmat(pArray(j), Ncond, 1);
j=j+1;
elseif model.t0 == Ncond
for c = 1:model.t0
t0(c,:) = pArray(j);
j=j+1;
end
else err = 1;
end
else
t0 = repmat(200, Ncond, 1); % fix if not free param
j=j+1;
end
if err == 1
fprintf('\n\n\nBad input! model fields can only take on values of 1 or Ncond. See help LBA_mle.\n\n');
return;
elseif length(pArray) > j-1
fprintf('\n\n\nBad input! pArray does not match model specification. See help LBA_mle.\n\n');
return;
end