Cody

Problem 1961. Finding neighbors of [-1:1] in a matrix....

Solution 343420

Submitted on 31 Oct 2013
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
%% 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))

Error: You may not use the command(s) assignin in your code

2   Fail
%% 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))

Error: You may not use the command(s) assignin in your code

3   Fail
%% 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))

Error: You may not use the command(s) assignin in your code

Suggested Problems

More from this Author17

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!