Cody

Solution 2104224

Submitted on 24 Jan 2020
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
A = randn(5,5); assert(isequal(arraySlice(A,4,2),A(:,4)))

ans = 1.5439 0.6274 -1.3047 0.2510 -1.2781

Output argument "S" (and maybe others) not assigned during call to "arraySlice". Error in Test1 (line 2) assert(isequal(arraySlice(A,4,2),A(:,4)))

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

ans = -0.7785 0.7492 1.7428 -0.4860 0.3060

Output argument "S" (and maybe others) not assigned during call to "arraySlice". Error in Test2 (line 2) assert(isequal(arraySlice(A,4,1),A(4,:)))

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

ans = 0.1120 -1.0035 -1.8350 1.1626 0.7028 0.6359 -0.1896 -1.6600 0.7528 -0.4112 -0.5959 2.0473 0.1344 1.6616 -0.1656 -0.0331 -0.2772 -0.3473 -1.1907 1.8143 -0.2463 0.2373 -0.7730 1.9454 0.2142

Output argument "S" (and maybe others) not assigned during call to "arraySlice". Error in Test3 (line 2) assert(isequal(arraySlice(A,1,10),A))

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

ans(:,:,1) = -2.0226 0.1903 -0.7533 -0.8698 -0.6657 0.5919 -0.0740 0.6677 -0.2273 -0.4237 0.5572 -1.1243 -0.5578 -1.1593 -0.1315 -0.6894 0.4591 0.7278 0.2294 -0.9140 -1.7358 -0.9418 0.5099 -0.9075 0.7953 ans(:,:,2) = 0.3026 -0.5205 -0.0843 -0.5427 1.7932 -0.2702 -0.3659 -0.0386 0.0434 -0.3586 -0.4536 0.2775 1.2576 0.1425 -1.6808 -0.1365 -1.6058 -0.8075 1.1372 -1.4115 1.1606 0.7226 -0.0302 -0.8249 -0.3143 ans(:,:,3) = -1.4340 1.1617 0.6419 -1.0953 -0.4893 -1.5128 1.4723 0.9261 0.4642 -1.1125 0.8653 0.2583 2.8897 -0.3571 0.4301 0.2262 -1.4738 -0.4817 0.0568 -0.9391 0.7771 -0.2976 -2.0361 0.5696 0.5413 ans(:,:,4) = -0.0027 -0.8918 0.7840 1.5940 0.1111 -0.3685 0.2595 0.8786 -0.2012 -0.7763 1.0267 -0.2978 0.3557 1.2128 0.6756 1.1322 1.3227 0.4560 0.2035 1.5217 -1.4554 0.7257 1.5707 0.1163 0.7460 ans(:,:,5) = -0.0746 0.5633 -0.5283 -0.1057 -1.1526 0.2830 -1.2249 -0.4118 -0.5502 0.4961 -1.1856 -2.7206 -0.1267 1.2267 -0.8787 1.1365 0.2240 -2.2191 -1.1411 0.4027 0.0475 -0.4942 0.0199 0.7851 0.2819

Output argument "S" (and maybe others) not assigned during call to "arraySlice". Error in Test4 (line 2) assert(isequal(arraySlice(A,3,4),A(:,:,:,3)))

5   Fail
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)))

ans = -0.9910

Output argument "S" (and maybe others) not assigned during call to "arraySlice". Error in Test5 (line 2) assert(isequal(arraySlice(A,2,18),A(:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,2)))