-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconexos4.m
57 lines (44 loc) · 836 Bytes
/
conexos4.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
function [ contArray ] = conexos4(x,y,xor,yor,M )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
x=x+1;
y=y+1;
cc4=[];
for i=3:5
try
top=M(y-1,x,i);
catch
top=-1;
end
try
bot=M(y+1,x,i);
catch
bot=-1;
end
try
left=M(y,x-1,i);
catch
left=-1;
end
try
right=M(y,x+1,i);
catch
right=-1;
end
cc4=[cc4;top,bot,left,right];
end
cont=0;
contArray=[];
for u=1:4
for i=1:3
if cc4(i,u)==-1
else
if (M(yor+1,xor+1,2+i)>(cc4(i,u)-60)) && (M(yor+1,xor+1,2+i)<(cc4(i,u)+60))
cont=cont+1;
end
end
end
contArray=[contArray;cont];
cont=0;
end
end