Exercise 54 pts
Counter B
Color for the second pattern
clear; clc
A = [5 3 6 4 3 0 4 2 0 5;
3 5 1 4 3 6 2 1 4 0;
2 2 2 3 0 0 6 4 2 6;
2 0 6 1 1 0 1 0 2 0;
0 0 0 4 0 3 1 4 0 5;
6 2 3 6 2 0 5 3 5 6;
1 5 0 6 4 6 1 4 1 3;
4 2 0 0 2 2 3 4 3 2;
6 0 3 3 3]
for row = 1:10
for col = 1:8
if (A(row, col) < A(row, col+1)) && (A(row, col+1) < A(row, col+2))
counterA = counterA + 1;
elseif (A(row, col) > A(row, col+1)) && (A(row, col+1) > A(row, col+2))
counterB = counterB + 1;
end
end
end