Looks like the image toolbox still isn't available on Cody. Otherwise, padarray would be perfect for this one.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
x = [1];
y_correct = [0 0 0
0 1 0
0 0 0];
assert(isequal(zeroWrap(x),y_correct))
|
2 | Fail |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(m(2:end-1,2:end-1),x))
|
3 | Fail |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(sum(m(1,:)),0))
|
4 | Fail |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(sum(m(end,:)),0))
|
5 | Fail |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(sum(m(:,1)),0))
|
6 | Fail |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(sum(m(:,end)),0))
|
7 | Fail |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(size(m)-2,size(x)))
|
4835 Solvers
173 Solvers
Find out missing number from a vector of 9 elements
207 Solvers
Reverse the elements of an array
559 Solvers
153 Solvers