Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = [1 2 1;
5 6 7;
2 3 6];
output = [1 1 1;
1 1 1;
1 1 1]
assert(isequal(neighbors(x),output))
output =
1 1 1
1 1 1
1 1 1
a1 =
4 4 6
-3 -3 -1
a2 =
1 -1
1 1
1 3
a1 =
2×3 logical array
0 0 0
0 0 1
a2 =
3×2 logical array
1 1
1 1
1 0
n =
3
y =
3×3 logical array
1 1 1
1 1 1
1 1 1
|
2 | Pass |
x = [8 8 8;
4 4 4;
1 9 7]
output = [1 1 1;
1 1 1;
0 0 0]
assert(isequal(neighbors(x),output))
x =
8 8 8
4 4 4
1 9 7
output =
1 1 1
1 1 1
0 0 0
a1 =
-4 -4 -4
-3 5 3
a2 =
0 0
0 0
8 -2
a1 =
2×3 logical array
0 0 0
0 0 0
a2 =
3×2 logical array
1 1
1 1
0 0
n =
3
y =
3×3 logical array
1 1 1
1 1 1
0 0 0
|
3 | Pass |
x = [1 8 5;
4 10 22;
1 66 7]
output = [0 0 0;
0 0 0;
0 0 0]
assert(isequal(neighbors(x),output))
x =
1 8 5
4 10 22
1 66 7
output =
0 0 0
0 0 0
0 0 0
a1 =
3 2 17
-3 56 -15
a2 =
7 -3
6 12
65 -59
a1 =
2×3 logical array
0 0 0
0 0 0
a2 =
3×2 logical array
0 0
0 0
0 0
n =
3
y =
3×3 logical array
0 0 0
0 0 0
0 0 0
|
495 Solvers
Getting the row and column location from a matrix
236 Solvers
Return a list sorted by number of consecutive occurrences
173 Solvers
483 Solvers
5116 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!