Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = [1];
y_correct = [0 0 0
0 1 0
0 0 0];
assert(isequal(zeroWrap(x),y_correct))
y =
0 0 0
0 1 0
0 0 0
|
2 | Pass |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(m(2:end-1,2:end-1),x))
y =
0 0 0 0 0 0 0
0 3 1 9 4 3 0
0 7 9 8 3 10 0
0 2 5 9 2 7 0
0 6 8 7 5 9 0
0 0 0 0 0 0 0
|
3 | Pass |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(sum(m(1,:)),0))
y =
0 0 0 0 0 0 0
0 8 6 5 3 4 0
0 9 10 9 2 9 0
0 10 1 8 10 10 0
0 5 5 4 1 4 0
0 0 0 0 0 0 0
|
4 | Pass |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(sum(m(end,:)),0))
y =
0 0 0 0 0 0 0
0 10 5 9 4 5 0
0 9 10 10 10 8 0
0 2 1 3 6 6 0
0 2 10 6 2 9 0
0 0 0 0 0 0 0
|
5 | Pass |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(sum(m(:,1)),0))
y =
0 0 0 0 0 0 0
0 5 9 1 3 4 0
0 10 5 4 8 9 0
0 10 7 1 1 4 0
0 1 4 4 1 9 0
0 0 0 0 0 0 0
|
6 | Pass |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(sum(m(:,end)),0))
y =
0 0 0 0 0 0 0
0 4 9 10 7 4 0
0 9 2 10 7 3 0
0 6 4 5 4 9 0
0 8 5 8 1 8 0
0 0 0 0 0 0 0
|
7 | Pass |
x = randi(10,4,5);
m=zeroWrap(x);
assert(isequal(size(m)-2,size(x)))
y =
0 0 0 0 0 0 0
0 10 1 4 4 2 0
0 10 4 5 8 8 0
0 10 1 8 8 2 0
0 6 10 3 1 9 0
0 0 0 0 0 0 0
|
686 Solvers
Create an n-by-n null matrix and fill with ones certain positions
270 Solvers
400 Solvers
364 Solvers
Separate even from odd numbers in a vector - without loops
304 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!