Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
I = [[magic(8), ones(8,4), magic(8)];[zeros(10,5),magic(10), zeros(10,5)]; [magic(5),zeros(5,10),magic(5)]];
assert(isequal(crop_image(I,9,6,10,10),magic(10)));
ans =
92 99 1 8 15 67 74 51 58 40
98 80 7 14 16 73 55 57 64 41
4 81 88 20 22 54 56 63 70 47
85 87 19 21 3 60 62 69 71 28
86 93 25 2 9 61 68 75 52 34
17 24 76 83 90 42 49 26 33 65
23 5 82 89 91 48 30 32 39 66
79 6 13 95 97 29 31 38 45 72
10 12 94 96 78 35 37 44 46 53
11 18 100 77 84 36 43 50 27 59
|
2 | Pass |
I = [[magic(8), ones(8,4), magic(8)];[zeros(10,5),magic(10), zeros(10,5)]; [magic(5),zeros(5,10),magic(5)]];
assert(isequal(crop_image(I,19,1,5,10),[magic(5),zeros(5)]));
ans =
17 24 1 8 15 0 0 0 0 0
23 5 7 14 16 0 0 0 0 0
4 6 13 20 22 0 0 0 0 0
10 12 19 21 3 0 0 0 0 0
11 18 25 2 9 0 0 0 0 0
|
3 | Pass |
I = [zeros(10,20);[zeros(10,5),ones(10,10), zeros(10,5)]; zeros(5,20)];
assert(isequal(crop_image(I,11,6,10,10),ones(10)));
ans =
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
|
4 | Pass |
I = [1 2 3 4;5 6 7 8];
assert(isequal(crop_image(I,2,2,1,3),[6 7 8]));
ans =
6 7 8
|
2197 Solvers
Find the sum of the elements in the "second" diagonal
994 Solvers
213 Solvers
Mersenne Primes vs. All Primes
165 Solvers
Number of Even Elements in Fibonacci Sequence
665 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!