Cody

# Problem 44350. Breaking Out of the Matrix

Solution 2879585

Submitted on 26 Aug 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
M=[1 4 7 10; 2 5 8 11; 3 6 9 12]; R=2;C=3; X(:,:,1) =[1 4 7 ; 2 5 8]; X(:,:,2) =[2 5 8 ; 3 6 9]; X(:,:,3) =[4 7 10 ; 5 8 11]; X(:,:,4) =[5 8 11 ; 6 9 12]; assert(isequal(BreakTheMatrix(M,R,C),X))

c = 3 r = 4

Unable to perform assignment because the size of the left side is 3-by-2 and the size of the right side is 2-by-3. Error in BreakTheMatrix (line 9) y(:,:,k) = M([1:R]+j,[1:C]+i) Error in Test1 (line 9) assert(isequal(BreakTheMatrix(M,R,C),X))

2   Fail
x=1:ceil(35+25*rand());r=1;c=1; M=BreakTheMatrix(x,r,c); assert(all(arrayfun(@(y) (M(:,:,y)==y),1:numel(x))))

c = 1 r = 42 y(:,:,1) = 1 y(:,:,2) = 0 y(:,:,3) = 0 y(:,:,4) = 0 y(:,:,5) = 0 y(:,:,6) = 0 y(:,:,7) = 0 y(:,:,8) = 0 y(:,:,9) = 0 y(:,:,10) = 0 y(:,:,11) = 0 y(:,:,12) = 0 y(:,:,13) = 0 y(:,:,14) = 0 y(:,:,15) = 0 y(:,:,16) = 0 y(:,:,17) = 0 y(:,:,18) = 0 y(:,:,19) = 0 y(:,:,20) = 0 y(:,:,21) = 0 y(:,:,22) = 0 y(:,:,23) = 0 y(:,:,24) = 0 y(:,:,25) = 0 y(:,:,26) = 0 y(:,:,27) = 0 y(:,:,28) = 0 y(:,:,29) = 0 y(:,:,30) = 0 y(:,:,31) = 0 y(:,:,32) = 0 y(:,:,33) = 0 y(:,:,34) = 0 y(:,:,35) = 0 y(:,:,36) = 0 y(:,:,37) = 0 y(:,:,38) = 0 y(:,:,39) = 0 y(:,:,40) = 0 y(:,:,41) = 0 y(:,:,42) = 0

Index in position 1 exceeds array bounds (must not exceed 1). Error in BreakTheMatrix (line 9) y(:,:,k) = M([1:R]+j,[1:C]+i) Error in Test2 (line 2) M=BreakTheMatrix(x,r,c);

3   Pass
x=eye(7);r=2;c=2; M=BreakTheMatrix(x,r,c); ids=[1 8 15 22 29 36]; urs=ids(1:5)+1; lls=urs+5; z=setxor(1:size(M,3),[ids urs lls]); a1=arrayfun(@(a) isequal(M(:,:,a),eye(2)),ids); a2=arrayfun(@(a) isequal(M(:,:,a),[0 1 ; 0 0]),urs); a3=arrayfun(@(a) isequal(M(:,:,a),[0 0 ; 1 0]),lls); a4=arrayfun(@(a) isequal(M(:,:,a),zeros(2)),z); assert(all([a1 a2 a3 a4]))

c = 7 r = 7 y(:,:,1) = 1 0 0 1 y(:,:,2) = 0 0 0 0 y(:,:,3) = 0 0 0 0 y(:,:,4) = 0 0 0 0 y(:,:,5) = 0 0 0 0 y(:,:,6) = 0 0 0 0 y(:,:,7) = 0 0 0 0 y(:,:,8) = 0 0 0 0 y(:,:,9) = 0 0 0 0 y(:,:,10) = 0 0 0 0 y(:,:,11) = 0 0 0 0 y(:,:,12) = 0 0 0 0 y(:,:,13) = 0 0 0 0 y(:,:,14) = 0 0 0 0 y(:,:,15) = 0 0 0 0 y(:,:,16) = 0 0 0 0 y(:,:,17) = 0 0 0 0 y(:,:,18) = 0 0 0 0 y(:,:,19) = 0 0 0 0 y(:,:,20) = 0 0 0 0 y(:,:,21) = 0 0 0 0 y(:,:,22) = 0 0 0 0 y(:,:,23) = 0 0 0 0 y(:,:,24) = 0 0 0 0 y(:,:,25) = 0 0 0 0 y(:,:,26) = 0 0 0 0 y(:,:,27) = 0 0 0 0 y(:,:,28) = 0 0 0 0 y(:,:,29) = 0 0 0 0 y(:,:,30) = 0 0 0 0 y(:,:,31) = 0 0 0 0 y(:,:,32) = 0 0 0 0 y(:,:,33) = 0 0 0 0 y(:,:,34) = 0 0 0 0 y(:,:,35) = 0 0 0 0 y(:,:,36) = 0 0 0 0 y(:,:,1) = 1 0 0 1 y(:,:,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:,:,8) = 0 0 0 0 y(:,:,9) = 0 0 0 0 y(:,:,10) = 0 0 0 0 y(:,:,11) = 0 0 0 0 y(:,:,12) = 0 0 0 0 y(:,:,13) = 0 0 0 0 y(:,:,14) = 0 0 0 0 y(:,:,15) = 0 0 0 0 y(:,:,16) = 0 0 0 0 y(:,:,17) = 0 0 0 0 y(:,:,18) = 0 0 0 0 y(:,:,19) = 0 0 0 0 y(:,:,20) = 0 0 0 0 y(:,:,21) = 0 0 0 0 y(:,:,22) = 0 0 0 0 y(:,:,23) = 0 0 0 0 y(:,:,24) = 0 0 0 0 y(:,:,25) = 0 0 0 0 y(:,:,26) = 0 0 0 0 y(:,:,27) = 0 0 0 0 y(:,:,28) = 0 0 0 0 y(:,:,29) = 0 0 0 0 y(:,:,30) = 0 0 0 0 y(:,:,31) = 0 0 0 0 y(:,:,32) = 0 0 0 0 y(:,:,33) = 0 0 0 0 y(:,:,34) = 0 0 0 0 y(:,:,35) = 0 0 0 0 y(:,:,36) = 0 0 0 0 y(:,:,1) = 1 0 0 1 y(:,:,2) = 0 1 0 0 y(:,:,3) = 0 0 0 0 y(:,:,4) = 0 0 0 0 y(:,:,5) = 0 0 0 0 y(:,:,6) = 0 0 0 0 y(:,:,7) = 0 0 0 0 y(:,:,8) = 0 0 0 0 y(:,:,9) = 0 0 0 0 y(:,:,10) = 0 0 0 0 y(:,:,11) = 0 0 0 0 y(:,:,12) = 0 0 0 0 y(:,:,13) = 0 0 0 0 y(:,:,14) = 0 0 0 0 y(:,:,15) = 0 0 0 0 y(:,:,16) = 0 0 0 0 y(:,:,17) = 0 0 0 0 y(:,:,18) = 0 0 0 0 y(:,:,19) = 0 0 0 0 y(:,:,20) = 0 0 0 0 y(:,:,21) = 0 0 0 0 y(:,:,22) = 0 0 0 0 y(:,:,23) = 0 0 0 0 y(:,:,24) = 0 0 0 0 y(:,:,25) = 0 0 0 0 y(:,:,26) = 0 0 0 0 y(:,:,27) = 0 0 0 0 y(:,:,28) = 0 0 0 0 y(:,:,29) = 0 0 0 0 y(:,:,30) = 0 0 0 0 y(:,:,31) = 0 0 0 0 y(:,:,32) = 0 0 0 0 y(:,:,33) = 0 0 0 0 y(:,:,34) = 0 0 0 0 y(:,:,35) = 0 0 0 0 y(:,:,36) = 0 0 0 0 y(:,:,1) = 1 0 0 1 y(:,:,2) = 0 1 0 0 y(:,:,3) = 0 0 0 0 y(:,:,4) = 0 0 0 0 y(:,:,5) = 0 0 0 0 y(:,:,6) = 0 0 0 0 y(:,:,7) = 0 0 1 0 y(:,:,8) = 0 0 0 0 y(:,:,9) = 0 0 0 0 y(:,:,10) = 0 0 0 0 y(:,:,11) = 0 0 0 0 y(:,:,12) = 0 0 0 0 y(:,:,13) = 0 0 0 0 y(:,:,14) = 0 0 0 0 y(:,:,15) = 0 0 0 0 y(:,:,16) = 0 0 0 0 y(:,:,17) = 0 0 0 0 y(:,:,18) = 0 0 0 0 y(:,:,19) = 0 0 0 0 y(:,:,20) = 0 0 0 0 y(:,:,21) = 0 0 0 0 y(:,:,22) = 0 0 0 0 y(:,:,23) = 0 0 0 0 y(:,:,24) = 0 0 0 0 y(:,:,25) = 0 0 0 0 y(:,:,26) = 0 0 0 0 y(:,:,27) = 0 0 0 0 y(:,:,28) = 0 0 0 0 y(:,:,29) = 0 0 ...

4   Pass
u=ceil(10*rand())+4; x=magic(u);r=u;c=u; M=BreakTheMatrix(x,r,c); assert(isequal(M,x))

c = 14 r = 14 y = 177 186 195 1 10 19 28 128 137 146 99 108 68 77 185 194 154 9 18 27 29 136 145 105 107 116 76 78 193 153 155 17 26 35 37 144 104 106 115 124 84 86 5 161 163 172 34 36 45 103 112 114 123 132 85 94 160 162 171 33 42 44 4 111 113 122 131 140 93 53 168 170 179 41 43 3 12 119 121 130 139 141 52 61 169 178 187 49 2 11 20 120 129 138 147 100 60 69 30 39 48 148 157 166 175 79 88 97 50 59 117 126 38 47 7 156 165 174 176 87 96 56 58 67 125 127 46 6 8 164 173 182 184 95 55 57 66 75 133 135 152 14 16 25 181 183 192 54 63 65 74 83 134 143 13 15 24 180 189 191 151 62 64 73 82 91 142 102 21 23 32 188 190 150 159 70 72 81 90 92 101 110 22 31 40 196 149 158 167 71 80 89 98 51 109 118

5   Pass
temp=ceil(8*rand)+3; x=ones(temp);r=2;c=2; M=BreakTheMatrix(x,r,c); assert(size(M,3)==(temp-1)^2); assert(all(arrayfun(@(a) isequal(M(:,:,a),ones(2)),1:size(M,3))))

c = 9 r = 9 y(:,:,1) = 1 1 1 1 y(:,:,2) = 0 0 0 0 y(:,:,3) = 0 0 0 0 y(:,:,4) = 0 0 0 0 y(:,:,5) = 0 0 0 0 y(:,:,6) = 0 0 0 0 y(:,:,7) = 0 0 0 0 y(:,:,8) = 0 0 0 0 y(:,:,9) = 0 0 0 0 y(:,:,10) = 0 0 0 0 y(:,:,11) = 0 0 0 0 y(:,:,12) = 0 0 0 0 y(:,:,13) = 0 0 0 0 y(:,:,14) = 0 0 0 0 y(:,:,15) = 0 0 0 0 y(:,:,16) = 0 0 0 0 y(:,:,17) = 0 0 0 0 y(:,:,18) = 0 0 0 0 y(:,:,19) = 0 0 0 0 y(:,:,20) = 0 0 0 0 y(:,:,21) = 0 0 0 0 y(:,:,22) = 0 0 0 0 y(:,:,23) = 0 0 0 0 y(:,:,24) = 0 0 0 0 y(:,:,25) = 0 0 0 0 y(:,:,26) = 0 0 0 0 y(:,:,27) = 0 0 0 0 y(:,:,28) = 0 0 0 0 y(:,:,29) = 0 0 0 0 y(:,:,30) = 0 0 0 0 y(:,:,31) = 0 0 0 0 y(:,:,32) = 0 0 0 0 y(:,:,33) = 0 0 0 0 y(:,:,34) = 0 0 0 0 y(:,:,35) = 0 0 0 0 y(:,:,36) = 0 0 0 0 y(:,:,37) = 0 0 0 0 y(:,:,38) = 0 0 0 0 y(:,:,39) = 0 0 0 0 y(:,:,40) = 0 0 0 0 y(:,:,41) = 0 0 0 0 y(:,:,42) = 0 0 0 0 y(:,:,43) = 0 0 0 0 y(:,:,44) = 0 0 0 0 y(:,:,45) = 0 0 0 0 y(:,:,46) = 0 0 0 0 y(:,:,47) = 0 0 0 0 y(:,:,48) = 0 0 0 0 y(:,:,49) = 0 0 0 0 y(:,:,50) = 0 0 0 0 y(:,:,51) = 0 0 0 0 y(:,:,52) = 0 0 0 0 y(:,:,53) = 0 0 0 0 y(:,:,54) = 0 0 0 0 y(:,:,55) = 0 0 0 0 y(:,:,56) = 0 0 0 0 y(:,:,57) = 0 0 0 0 y(:,:,58) = 0 0 0 0 y(:,:,59) = 0 0 0 0 y(:,:,60) = 0 0 0 0 y(:,:,61) = 0 0 0 0 y(:,:,62) = 0 0 0 0 y(:,:,63) = 0 0 0 0 y(:,:,64) = 0 0 0 0 y(:,:,1) = 1 1 1 1 y(:,:,2) = 1 1 1 1 y(:,:,3) = 0 0 0 0 y(:,:,4) = 0 0 0 0 y(:,:,5) = 0 0 0 0 y(:,:,6) = 0 0 0 0 y(:,:,7) = 0 0 0 0 y(:,:,8) = 0 0 0 0 y(:,:,9) = 0 0 0 0 y(:,:,10) = 0 0 0 0 y(:,:,11) = 0 0 0 0 y(:,:,12) = 0 0 0 0 y(:,:,13) = 0 0 0 0 y(:,:,14) = 0 0 0 0 y(:,:,15) = 0 0 0 0 y(:,:,16) = 0 0 0 0 y(:,:,17) = 0 0 0 0 y(:,:,18) = 0 0 0 0 y(:,:,19) = 0 0 0 0 y(:,:,20) = 0 0 0 0 y(:,:,21) = 0 0 0 0 y(:,:,22) = 0 0 0 0 y(:,:,23) = 0 0 0 0 y(:,:,24) = 0 0 0 0 y(:,:,25) = 0 0 0 0 y(:,:,26) = 0 0 0 0 y(:,:,27) = 0 0 0 0 y(:,:,28) = 0 0 0 0 y(:,:,29) = 0 0 0 0 y(:,:,30) = 0 0 0 0 y(:,:,31) = 0 0 0 0 y(:,:,32) = 0 0 0 0 y(:,:,33) = 0 0 0 0 y(:,:,34) = 0 0 0 0 y(:,:,35) = 0 0 0 0 y(:,:,36) = 0 0 0 0 y(:,:,37) = 0 0 0 0 y(:,:,38) = 0 0 0 0 y(:,:,39) = 0 0 0 0 y(:,:,40) = 0 0 0 0 y(:,:,41) = 0 0 0 0 y(:,:,42) = 0 0 0 0 y(:,:,43) = 0 0 0 0 y(:,:,44) = 0 0 0 0 y(:,:,45) = 0 0 0 0 y(:,:,46) = 0 0 0 0 y(:,:,47) = 0 0 0 0 y(:,:,48) = 0 0 0 0 y(:,:,49) = 0 0 0 0 y(:,:,50) = 0 0 0 0 y(:,:,51) = 0 0 0 0 y(:,:,52) = 0 0 0 0 y(:,:,53) = 0 0 0 0 y(:,:,54) = 0 0 0 0 y(:,:,55) = 0 0 0 0 y(:,:,56) = 0 0 0 0 y(:,:,57) = 0 0 0 0 y(:,:,58) = 0 0 0 0 y(:,:,59) = 0 0 0 0 y(:,:,60) = 0 0 0 0 y(:,:,61) = 0 0 0 0 y(:,:,62) = 0 0 0 0 y(:,:,63) = 0 0 0 0 y(:,:,64) = 0 0 0 0 y(:,:,1) = 1 1 1 1 y(:,:,2) = 1 1 1 1 y(:,:,3) = 1 1 1 1 y(:,:,4) = 0 0 0 0 y(:,:,5) = 0 0 0 0 y(:,:,6) = 0 0 0 0 y(:,:,7) = 0 0 0 0 y(:,:,8) = 0 0 0 0 y(:,:,9) = 0 0 0 0 y(:,:,10) = 0 0 0 0 y(:,:,11) = 0 0 0 0 y(:,:,12) = 0 0 0 0 y(:,:,13) = 0 0 0 0 y(:,:,14) = 0 0 0 0 y(:,:,15) = 0 0 0 0 y(:,:,16) = 0 0 0 0 y(:,:,17) = 0 0 0 0 y(:,:,18) = 0 0 0 0 y(:,:,19) = 0 0 0 0 y(:,:,20) = 0 0 0 0 y(:,:,21) = 0 0 0 0 y(:,:,22) = 0 0 0 0 y(:,:,23) = 0 0 0 0 y(:,:,24) = 0 0 0 0 y(:,:,25) = 0 0 0 0 y(:,:,26) = 0 0 0 0 y(:,:,27) = 0 0 0 0 y(:,:,28) = 0 0 0 0 y(:,:,29) = 0 0 0 0 y(:,:,30) = 0 0 0 0 y(:,:,31) = 0 0 0 0 y(:,:,32) = 0 0 0 0 y(:,:,33) = 0 0 0 0 y(:,:,34) = 0 0 0 0 y(:,:,35) = 0 0 0 0 y(:,:,36) = 0 0 0 0 y(:,:,37) = 0 0 0 0 y(:,:,38) = 0 0 0 0 y(:,:,39) = 0 0 0 0 y(:,:,40) = 0 0 0 0 y(:,:,41) = 0 0 0 0 y(:,:,42) = 0 0 0 0 y(:,:,43) = 0 0 0 0 y(:,:,44) = 0 0 0 0 y(:,:,45) = 0 0 0 0 y(:,:,46) = 0 0 0 0 y(:,:,47) = 0 0 0 0 y(:,:,48) = 0 0 0 0 y(:,:,49) = 0 0 0 0 y(:,:,50) = 0 0 0 0 y(:,:,51) = 0 0 0 0 y(:,:,52) = 0 0 0 0 y(:,:,53) = 0 0 0 0 y(:,:,54) = 0 0 0 0 y(:,:,55) = 0 0 0 0 y(:,:,56) = 0 0 0 0 y(:,:,57) = 0 0 0 0 y(:,:,58) = 0 0 0 0 y(:,:,59) = 0 0 0 0 y(:,:,60) = 0 0 0 0 y(:,:,61) = 0 0 0 0 y(:,:,62) = 0 0 0 0 y(:,:,63) = 0 0 0 0 y(:,:,64) = 0 0 0 0 y(:,:,1) = 1 1 1 1 y(:,:,2) = 1 1 1 1 y(:,:,3) = 1 1 1 1 y(:,:,4) = 1 1 1 1 y(:,:,5) = 0 0 0 0 y(:,:,6) = 0 0 0 0 y(:,:,7) = 0 0 0 0 y(:,:,8) = 0 0 0 0 y(:,:,9) = 0 0 0 0 y(:,:,10) = 0 0 0 0 y(:,:,11) = 0 0 0 0 y(:,:,12) = 0 0 0 0 y(:,:,13) = 0 0 0 0 y(:,:,14) = 0 0 0 0 y(:,:,15) = 0 0 0 0 y(:,:,16) = 0 0 0 0 y(:,:,17) = 0 0 0 0 y(:,:,18) = 0 0 0 0 y(:,:,19) = 0 0 0 0 y(:,:,20) = 0 0 0 0 y(:,:,21) = 0 0 0 0 y(:,:,22) = 0 0 0 0 y(:,:,23) = 0 0 0 0 y(:,:,24) = 0 0 0 0 y(:,:,25) = 0 0 0 0 y(:,:,26) = 0 0 0 0 y(:,:,27) = 0 0 0 0 y(:,:,28) = 0 0 0 0 y(:,:,29) = 0 0 0 0 y(:,:,30) = 0 0 0 0 y(:,:,31) = 0 0 0 0 y(:,:,32) = 0 0 0 0 y(:,:,33) = 0 0 0 0 y(:,:,34) = 0 0 0 0 y(:,:,35) = 0 0 0 0 y(:,:,36) = 0 0 0 0 y(:,:,37) = 0 0 0 0 y(:,:,38) = 0 0 0 0 y(:,:,39) = 0 0 0 0 y(:,:,40) = 0 0 0 0 y(:,:,41) = 0 0 0 0 y(:,:,42) = 0 0 0 0 y(:,:,43) = 0 0 0 0 y(:,:,44) = 0 0 0 0 y(:,:,45) = 0 0 0 0 y(:,:,46) = 0 0 0 0 y(:,:,47) = 0 0 0 0 y(:,:,48) = 0 0 0 0 y(:,:,49) = 0 0 0 0 y(:,:,50) = 0 0 0 0 y(:,:,51) = 0 0 0 0 y(:,:,52) = 0 0 0 0 y(:,...

6   Pass
x=eye(7);r=7;c=7; assert(isequal(x,BreakTheMatrix(x,r,c)))

c = 7 r = 7 y = 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!