-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReverseZigzaging.m
46 lines (46 loc) · 1.22 KB
/
ReverseZigzaging.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
function Entropy = ReverseZigzaging(List, n)
Entropy = cell(1, length(List));
for Index=1:length(List)
Win = zeros(n, 'double');
k=1;
for i=1:n
if List{Index}(k)==-1000
break;
end
for j=1:i
if mod(i, 2)==1
Win(i+1-j, j) = List{Index}(k);
else
Win(j, i+1-j) = List{Index}(k);
end
k=k+1;
if List{Index}(k)==-1000
break;
end
end
if List{Index}(k)==-1000
break;
end
end
for i=2:n
if List{Index}(k)==-1000
break;
end
for j=i:n
if mod(n-i, 2)==1
Win(j, n+i-j) = List{Index}(k);
else
Win(n+i-j, j) = List{Index}(k);
end
k=k+1;
if List{Index}(k)==-1000
break;
end
end
if List{Index}(k)==-1000
break;
end
end
Entropy{Index} = Win;
end
end