Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
A = randn(5,5);
assert(isequal(arraySlice(A,4,2),A(:,4)))
y =
-2.1691
1.8467
-0.3745
0.8933
-1.3618
|
2 | Pass |
%%
A = randn(5,5);
assert(isequal(arraySlice(A,4,1),A(4,:)))
y =
-0.4226 1.4445 0.3166 -1.3824 -1.0957
|
3 | Pass |
%%
A = randn(5,5);
assert(isequal(arraySlice(A,1,10),A))
y =
-0.6113 -0.0833 -0.8603 0.4396 0.2232
-1.2492 0.8196 1.5925 -1.6109 -1.2038
1.6800 -0.6122 0.5797 0.4134 -0.5305
-0.5606 0.2376 0.2229 -1.0403 0.4471
0.8905 -0.7325 1.1829 0.8479 -1.7706
|
4 | Pass |
%%
A = randn(5,5,5,3);
assert(isequal(arraySlice(A,3,4),A(:,:,:,3)))
y(:,:,1) =
0.4235 -0.1104 -0.8137 -0.8040 -0.7856
0.5135 -1.1818 0.0713 -0.3002 -0.0830
0.7855 -0.0776 0.7093 -0.2454 -1.1883
0.4531 -0.0648 1.1279 0.3076 -1.0859
0.1086 -0.8599 0.2922 0.5587 -1.6596
y(:,:,2) =
-0.3694 -0.0464 0.8483 -0.2646 0.0509
-2.2365 0.2044 0.1482 1.0389 0.4888
0.2330 0.1962 -0.9091 1.2311 -1.4094
-2.1745 0.1421 0.9192 0.1366 1.7829
-0.2313 0.7999 -0.2866 -1.0301 0.1386
y(:,:,3) =
0.5231 -0.0488 0.4311 0.9599 0.5641
1.7612 1.5691 1.1081 2.1827 0.0938
-1.0408 0.9969 0.2519 -0.5922 2.3136
-1.1872 -1.3015 -0.5881 1.4446 -0.2814
0.2699 -0.8217 -0.0671 0.8584 -1.2959
y(:,:,4) =
-0.3757 -1.0340 0.9155 2.3650 0.9980
-1.2498 1.0137 1.3870 -0.3967 1.5162
-0.1202 1.6292 -0.5915 -0.4250 0.6436
0.1892 -0.8944 1.0880 1.3662 -1.5308
-0.2614 -0.0507 -1.2278 -0.4585 -0.8000
y(:,:,5) =
0.8314 -0.7187 0.7876 1.9447 -0.7627
-0.6222 0.3855 0.3010 -0.1024 -0.6395
-0.4918 -0.7715 -1.1794 2.1943 -0.2912
2.1054 0.1820 0.5011 -0.0706 0.7668
-0.3376 0.8846 -1.2676 0.3622 0.1933
|
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)))
y =
0.6737
|
Return the largest number that is adjacent to a zero
3749 Solvers
1163 Solvers
Omit columns averages from a matrix
527 Solvers
Back to basics 23 - Triangular matrix
634 Solvers
Sum of first n terms of a harmonic progression
257 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!