Cody

# Problem 1852. Repeat middle rows and columns of an array

Solution 1508267

Submitted on 29 Apr 2018 by Noriko HOUNOKI
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   Pass
A = randi(100,2); assert(isequal(repmatmid(A),A))

2   Pass
A = magic(3); B_correct = [8 1 1 6; 3 5 5 7; 3 5 5 7; 4 9 9 2]; assert(isequal(repmatmid(A),B_correct))

3   Pass
A = reshape(1:16,4,4); B_correct = [1 5 5 9 9 13; 2 6 6 10 10 14; 2 6 6 10 10 14; 3 7 7 11 11 15; 3 7 7 11 11 15; 4 8 8 12 12 16]; assert(isequal(repmatmid(A),B_correct))

4   Pass
A = eye(5); B_correct = [1 0 0 0 0 0 0 0; 0 1 1 0 0 0 0 0; 0 1 1 0 0 0 0 0; 0 0 0 1 1 0 0 0; 0 0 0 1 1 0 0 0; 0 0 0 0 0 1 1 0; 0 0 0 0 0 1 1 0; 0 0 0 0 0 0 0 1]; assert(isequal(repmatmid(A),B_correct))

5   Pass
A = randi(100,42); B = repmatmid(A); C = diff(B,1,1); D = diff(B,1,2); assert(all(all(C(2:2:end,:)==0))) assert(all(all(D(:,2:2:end)==0)))