-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmergeDpi.m
53 lines (44 loc) · 1.07 KB
/
mergeDpi.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
function [dp dm] = mergeDpi(dpcell,dmcell)
% [dp dm] = mergeDpi(dpcell,dmcell)
% ---------------------------------
%
% Merges the dpi and dmi's of different syzygy-systems in order to obtain
% the full dp and dm as found by aln.m
%
% dp = vector, contains the degrees for which positive
% contributions occur
%
% dm = vector, contains the degrees for which negative
% contributions occur
%
% dpcell = cell, each entry contains the dpi of i'th syzygy-system
%
% dmcell = cell, each entry contains the dmi of i'th syzygy-system
%
% CALLS
% -----
%
% Kim Batselier, 2012
dpi =[];
dmi =[];
dp = [];
dm=[];
for i = 1 : size(dpcell,2)
dpi = [dpi,dpcell{i}];
dmi = [dmi,dmcell{i}];
end
if isempty(dmi)
dmin = min(dpi);
dmax = max(dpi);
else
dmin = min(min(dpi),min(dmi));
dmax = max(max(dpi),max(dmi));
end
for i = dmin:dmax
if sum(dpi==i)-sum(dmi==i) < 0
dm = [dm i*ones(1,sum(dmi==i)-sum(dpi==i))];
elseif sum(dpi==i)-sum(dmi==i) > 0
dp = [dp i*ones(1,sum(dpi==i)-sum(dmi==i))];
end
end
end