Cody

# Problem 44887. Given a matrix A (size m x n) create a matrix B (size m+2 x n+2) which consists of matrix A surrounded by zeros. See Example below:

Solution 1859938

Submitted on 27 Jun 2019
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 = ; y_correct = [0 0 0 0 1 0 0 0 0]; assert(isequal(zeroWrap(x),y_correct))

Undefined function 'padarray' for input arguments of type 'double'. Error in zeroWrap (line 2) y = padarray(B,[1 1],0,'both'); Error in Test1 (line 5) 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))

Undefined function 'padarray' for input arguments of type 'double'. Error in zeroWrap (line 2) y = padarray(B,[1 1],0,'both'); Error in Test2 (line 2) m=zeroWrap(x);

3   Fail
x = randi(10,4,5); m=zeroWrap(x); assert(isequal(sum(m(1,:)),0))

Undefined function 'padarray' for input arguments of type 'double'. Error in zeroWrap (line 2) y = padarray(B,[1 1],0,'both'); Error in Test3 (line 2) m=zeroWrap(x);

4   Fail
x = randi(10,4,5); m=zeroWrap(x); assert(isequal(sum(m(end,:)),0))

Undefined function 'padarray' for input arguments of type 'double'. Error in zeroWrap (line 2) y = padarray(B,[1 1],0,'both'); Error in Test4 (line 2) m=zeroWrap(x);

5   Fail
x = randi(10,4,5); m=zeroWrap(x); assert(isequal(sum(m(:,1)),0))

Undefined function 'padarray' for input arguments of type 'double'. Error in zeroWrap (line 2) y = padarray(B,[1 1],0,'both'); Error in Test5 (line 2) m=zeroWrap(x);

6   Fail
x = randi(10,4,5); m=zeroWrap(x); assert(isequal(sum(m(:,end)),0))

Undefined function 'padarray' for input arguments of type 'double'. Error in zeroWrap (line 2) y = padarray(B,[1 1],0,'both'); Error in Test6 (line 2) m=zeroWrap(x);

7   Fail
x = randi(10,4,5); m=zeroWrap(x); assert(isequal(size(m)-2,size(x)))

Undefined function 'padarray' for input arguments of type 'double'. Error in zeroWrap (line 2) y = padarray(B,[1 1],0,'both'); Error in Test7 (line 2) m=zeroWrap(x);