Cody

Solution 1132373

Submitted on 2 Mar 2017 by mohammad z
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 = randn(5,5); assert(isequal(arraySlice(A,4,2),A(:,4)))

S = 0.6098 -0.9252 -0.3586 -0.5037 1.4761

2   Pass
A = randn(5,5); assert(isequal(arraySlice(A,4,1),A(4,:)))

S = 0.4442 -0.0738 -0.6695 0.3539 -1.1303

3   Pass
A = randn(5,5); assert(isequal(arraySlice(A,1,10),A))

S = 0.6961 -0.1214 1.3094 -1.1598 0.6331 -1.7953 -0.6715 -1.1015 1.9845 -0.2033 -0.1507 0.7597 0.0294 1.3406 -0.1347 -0.6842 -1.0928 -1.1665 -0.4786 0.2207 0.4808 0.8576 0.0729 0.3755 1.1737

4   Pass
A = randn(5,5,5,3); assert(isequal(arraySlice(A,3,4),A(:,:,:,3)))

5   Pass
A = randn(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2); assert(isequal(arraySlice(A,2,18),A(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,2)))

S = -0.8251