Cody

Solution 1940237

Submitted on 17 Sep 2019 by Chompo40
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 = [15 13 3]; y_correct = [15 0 3]; assert(isequal(your_fcn_name(A),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for command is forbidden') assert(isempty(strfind(filetext, 'while')),'while command is forbidden') assert(isempty(strfind(filetext, 'find')),'find command is forbidden') assert(isempty(strfind(filetext, 'ind2sub')),'ind2sub command is forbidden')

B = 15 13 3 B = 15 0 3

2   Pass
A = 13; y_correct = 0; assert(isequal(your_fcn_name(A),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for command is forbidden') assert(isempty(strfind(filetext, 'while')),'while command is forbidden') assert(isempty(strfind(filetext, 'find')),'find command is forbidden') assert(isempty(strfind(filetext, 'ind2sub')),'ind2sub command is forbidden')

B = 13 B = 0

3   Pass
A = []; y_correct = []; assert(isequal(your_fcn_name(A),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for command is forbidden') assert(isempty(strfind(filetext, 'while')),'while command is forbidden') assert(isempty(strfind(filetext, 'find')),'find command is forbidden') assert(isempty(strfind(filetext, 'ind2sub')),'ind2sub command is forbidden')

B = [] B = []

4   Pass
A = [13 0 13; 13 13 8; 13 25 2]; titi = [0 0 0 ; 0 0 8;0 25 2]; assert(isequal(your_fcn_name(A),titi)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for command is forbidden') assert(isempty(strfind(filetext, 'while')),'while command is forbidden') assert(isempty(strfind(filetext, 'find')),'find command is forbidden') assert(isempty(strfind(filetext, 'ind2sub')),'ind2sub command is forbidden')

B = 13 0 13 13 13 8 13 25 2 B = 0 0 0 0 0 8 0 25 2

5   Pass
A=rand(10,10,10); A(1,2,2)=13; A(3,4,1)=13; A(5,6,3)=13; % what you cannot do but me I can ;) ! titi = A; I=find(titi==13); [u,v,w]=ind2sub(size(titi),I); for ii = 1 : numel(u) titi(u(ii),v(ii),w(ii))=0; end assert(isequal(your_fcn_name(A),titi)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for command is forbidden') assert(isempty(strfind(filetext, 'while')),'while command is forbidden') assert(isempty(strfind(filetext, 'find')),'find command is forbidden') assert(isempty(strfind(filetext, 'ind2sub')),'ind2sub command is forbidden')

B(:,:,1) = 0.6649 0.3149 0.0740 0.0281 0.5742 0.2421 0.3348 0.5078 0.8231 0.6955 0.9882 0.0230 0.2481 0.8081 0.8272 0.2766 0.2377 0.1150 0.8399 0.6632 0.0888 0.7891 0.4698 13.0000 0.3596 0.6798 0.4058 0.9367 0.6833 0.2374 0.6183 0.6943 0.6274 0.0134 0.0244 0.9917 0.9586 0.0174 0.4605 0.7527 0.3760 0.8923 0.7509 0.5857 0.8855 0.5340 0.1261 0.6431 0.6510 0.2930 0.4346 0.8266 0.1734 0.7662 0.1419 0.5310 0.6279 0.4993 0.0948 0.6637 0.1511 0.5744 0.6234 0.8067 0.0270 0.8346 0.6450 0.9249 0.6472 0.2575 0.4066 0.3507 0.8671 0.1794 0.0567 0.6694 0.5779 0.8318 0.8217 0.9176 0.6539 0.7622 0.2936 0.8742 0.1554 0.5857 0.8033 0.8642 0.1249 0.1387 0.6692 0.4167 0.2890 0.5198 0.8678 0.0186 0.0620 0.9126 0.3244 0.2892 B(:,:,2) = 0.6456 13.0000 0.9204 0.3332 0.0053 0.9446 0.6037 0.1094 0.0821 0.0699 0.3860 0.0396 0.2234 0.8131 0.7725 0.4640 0.6674 0.8619 0.0518 0.2761 0.2279 0.1277 0.4081 0.3264 0.8378 0.6538 0.8230 0.3303 0.2372 0.5435 0.8406 0.5093 0.7155 0.8817 0.2530 0.6604 0.3312 0.1501 0.4625 0.2542 0.8445 0.4565 0.2316 0.5780 0.5377 0.9202 0.3254 0.4752 0.0117 0.7219 0.8036 0.8891 0.2050 0.5339 0.1316 0.7357 0.7155 0.3260 0.6472 0.3737 0.2774 0.2066 0.6787 0.3529 0.0487 0.1725 0.4704 0.0404 0.2741 0.2186 0.1745 0.8922 0.5826 0.2827 0.4105 0.7776 0.1998 0.0496 0.5494 0.3861 0.0711 0.4349 0.7791 0.4415 0.0261 0.0317 0.7927 0.1419 0.8765 0.7063 0.5976 0.8068 0.6255 0.1549 0.3994 0.3339 0.5968 0.1695 0.6765 0.6581 B(:,:,3) = 0.5591 0.1121 0.2386 0.0987 0.0095 0.0587 0.3821 0.4089 0.1141 0.2122 0.8215 0.3114 0.7514 0.6426 0.7635 0.0520 0.7022 0.5083 0.7921 0.1049 0.9515 0.3078 0.0796 0.2639 0.1864 0.0097 0.8830 0.5043 0.3694 0.9628 0.7147 0.1761 0.6495 0.9151 0.9206 0.3533 0.9730 0.9045 0.1248 0.8996 0.5528 0.6419 0.4941 0.4399 0.4564 13.0000 0.0730 0.5314 0.3360 0.9962 0.5995 0.7604 0.5176 0.9154 0.0792 0.2434 0.9913 0.2784 0.9106 0.6257 0.8450 0.5575 0.6337 0.3312 0.2944 0.9471 0.6204 0.2430 0.6379 0.4495 0.3415 0.9315 0.7306 0.9596 0.3616 0.0463 0.9442 0.8447 0.3523 0.8187 0.0438 0.1935 0.2408 0.2664 0.0117 0.5743 0.5765 0.2044 0.3619 0.7920 0.0547 0.0436 0.5585 0.2311 0.4447 0.3799 0.6761 0.2747 0.4835 0.6663 B(:,:,4) = 0.3848 0.8439 0.4056 0.6925 0.2736 0.4465 0.9334 0.2519 0.9880 0.7648 0.9787 0.8117 0.8586 0.2524 0.8454 0.9448 0.9289 0.0564 0.5430 0.1373 0.6950 0.8976 0.9361 0.2382 0.5874 0.8801 0.2226 0.7469 0.0657 0.9771 0.5139 0.5138 0.7166 0.4350 0.3038 0.5454 0.0805 0.1311 0.9069 0.9940 0.0417 0.8893 0.1346 0.2022 0.2845 0.0294 0.1996 0.4433 0.0368 0.8898 0.0657 0.3825 0.8652 0.5390 0.3533 0.9721 0.3463 0.6503 0.5358 0.8276 0.5413 0.3176 0.7644 0.1151 0.8041 0.2907 0.4189 0.8679 0.7674 0.7702 0.5673 0.2846 0.2833 0.0577 0.6525 0.0275 0.3363 0.9989 0.8767 0.1825 0.8547 0.7836 0.5772 0.3292 0.7132 0.3147 0.6950 0.8961 0.3232 0.4666 0.4243 0.4674 0.5007 0.7491 0.3260 0.8253 0.9151 0.9014 0.7624 0.9861 B(:,:,5) = 0.8817 0.6756 0.8185 0.5212 0.9050 0.7790 0.5901 0.5787 0.3926 0.3205 0.1946 0.9859 0.1243 0.3359 0.5766 0.2397 0.1358 0.6436 0.8536 0.5381 0.7844 0.2267 0.3258 0.6173 0.0531 0.9490 0.2849 0.0412 0.0558 0.2173 0.7428 0.0367 0.1935 0.4646 0.4809 0.0077 0.0244 0.4959 0.2420 0.3370 0.1054 0.4260 0.8696 0.8896 0.6450 0.9714 0.4790 0.7210 0.8648 0.6578 0.6659 0.8578 0.0302 0.3579 0.1678 0.7246 0.8598 0.5185 0.0994 0.4025 0.1830 0.2215 0.1137 0.9141 0.2283 0.0650 0.7233 0.6244 0.9912 0.5122 0.3253 0.0925 0.9704 0.7924 0.5953 0.7587 0.8776 0.5009 0.0474 0.9130 0.8650 0.6705 0.4069 0.7079 0.4058 0.3302 0.9269 0.5712 0.4393 0.4894 0.9880 0.2705 0.6495 0.8331 0.1923 0.0158 0.1666 0.1143 0.0186 0.6635 B(:,:,6) = 0.8150 0.2449 0.8567 0.1347 0.1944 0.2351 0.1862 0.6976 0.8325 0.0525 0.8555 0.4292 0.1958 0.5666 0.5030 0.8945 0.0143 0.7123 0.1575 0.2534 0.2001 0.6062 0.5772 0.2776 0.0508 0.1169 0.0546 0.6653 0.7237 0.1892 0.8052 0.1009 0.7819 0.9189 0.3654 0.2660 0.0588 0.3299 0.4580 0.0443 0.9266 0.2469 0.7836 0.8213 0.3939 0.9017 0.8022 0.7996 0.7696 0.4899 0.0324 0.4829 0.2798 0.1947 0.9041 0.3277 0.1591 0.7432 0.7116 0.0348 0.3956 0.6481 0.8064 0.0961 0.9654 0.9245 0.0168 0.9873 0.4589 0.5328 0.0921 0.0876 0.5159 0.9182 0.3418 0.8119 0.8897 0.3244 0.9384 0.9372 0.9037 0.7149 0.0316 0.2176 0.4811 0.3057 0.8731 0.0528 0.7941 0.4102 0.4127 0.9738 0.0091 0.0238 0.3468 0.7201 0.5073 0.3575 0.8987 0.0366 B(:,:,7) = 0.7392 0.4885 0.1356 0.7963 0.4397 0.2879 0.5245 0.8908 0.8079 0.6798 0.9992 0.1078 0.0908 0.6919 0.8722 0.7431 0.7404 0.2876 0.3562 0.0242 0.1399 0.0487 0.3635 0.1183 0.7329 0.0789 0.2778 0.1491 0.3012 0.7832 0.1005 0.3183 0.0287 0.7169 0.6703 0.8085 0.6081 0.2219 0.7915 0.7508 0.5845 0.8383 0.1085 0.4735 0.7444 0.4201 0.0935 0.8402 0.0274 0.6309 0.4948 0.1284 0.7917 0.1059 0.1073 0.0119 0.6739 0.3398 0.4234 0.0410 0.4158 0.8433 0.8433 0.1891 0.1507 0.6369 0.0266 0.7545 0.9672 0.0173 0.1227 0.0456 0.9005 0.7020 0.0051 0.3021 0.1526 0.1625 0.6905 0.8526 0.8931 0.1601 0.3790 0.4540 0.9721 0.0969 0.1560 0.2618 0.5368 0.0407 0.4989 0.3205 0.2439 0.3315 0.5841 0.1130 0.3735 0.0339 0.1479 0.3109 B(:,:,8) = 0.7652 0.7317 0.1862 0.4759 0.9870 0.4046 0.0090 0.9707 0.5756 0.0928 0.0085 0.8173 0.8916 0.6260 0.4938 0.8628 0.7170 0.0057 0.5049 0.9905 0.9818 0.1616 0.0487 0.9342 0.6254 0.7253 0.0704 0.8123 0.8274 0.2658 0.4125 0.6695 0.0352 0.7713 0.5867 0.2695 0.9949 0.3473 0.1052 0.0324 0.5702 0.9188 0.4539 0.3718 0.2872 0.4463 0.1778 0.9300 0.6110 0.4867 0.9358 0.1437 0.4340 0.7376 0.4249 0.1869 0.7128 0.4818 0.2135 0.9869 0.4631 0.8830 0.8263 0.9141 0.6544 0.6407 0.0213 0.4119 0.1549 0.1054 0.4027 0.8480 0.3810 0.6106 0.5979 0.3393 0.9350 0.1179 0.9894 0.4754 0.0450 0.7770 0.3605 0.1678 0.5917 0.2720 0.8093 0.5154 0.3812 0.6759 0.6644 0.9342 0.5318 0.0129 0.0082 0.7307 0.3874 0.1101 0.9123 0.5782 B(:,:,9) = 0.1382 0.6454 0.5209 0.2835 0.8568 0.5336 0.9314 0.7254 0.5891 0.0966 0.4560 0.7424 0.3863 0.6266 0.0453 0.2333 0.5250 0.7467 0.5864 0.8775 0.1145 0.8304 0.1885 0.9830 0.8235 0.0942 0.9470 0.3412 0.1908 0.5474 0.3544 0.0140 0.6704 0.2440 0.8201 0.7475 0.9297 0.0750 0.7738 0.5606 0.1634 0.2553 0.9003 0.9802 0.9521 0.6923 0.2074 0.5245 0.2951 0.7232 0.4395 0.2980 0.9851 0.8376 0.0694 0.9236 0.1426 0.4460 0.4359 0.1131 0.9829 0.4922 0.5714 0.4342 0.4409 0.7202 0.3780 0.3786 0.9939 0.0886 0.1253 0.2335 0.9026 0.7381 0.0719 0.5867 0.7318 0.1506 0.9784 0.2274 0.3191 0.6272 0.0796 0.2875 0.0877 0.2115 0.5102 0.7690 0.6548 0.7074 0.8754 0.9389 0.0102 0.5308 0.5645 0.0790 0.2872 0.7158 0.0838 0.1976 B(:,:,10) = 0.3822 0.5279 0.2602 0.9295 0.3635 0.4230 0.5706 0.7493 0.8306 0.6984 0.2588 0.9081 0.6334 0.4957 0.3597 0.2419 0.6557 0.6199 0.3003 0.7265 0.5242 0.3603 0.9389 0.2582 0.8013 0.8661 0.3909 0.2829 0.3642 0.0173 0.4425 0.7140 0.3346 0.3154 0.0287 0.0800 0.9810 0.4162 0.3387 0.2477 0.8574 0.1054 0.1248 0.8911 0.3140 0.4955 0.1870 0.0474 0.0511 0.2546 0.3917 0.1549 0.5365 0.5144 0.8556 0.0704 0.1949 0.3710 0.1827 0.0230 0.3852 0.1581 0.8288 0.4421 0.8898 0.2160 0.9266 0.4775 0.1853 0.0896 0.4039 0.9110 0.2890 0.8871 0.8956 0.7393 ...

6   Pass
A = repmat(13,89,17); assert(isequal(your_fcn_name(A),repmat(0,89,17))) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for command is forbidden') assert(isempty(strfind(filetext, 'while')),'while command is forbidden') assert(isempty(strfind(filetext, 'find')),'find command is forbidden') assert(isempty(strfind(filetext, 'ind2sub')),'ind2sub command is forbidden')

B = 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 B = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

7   Pass
A= magic(5); B =A; B(3,3) = 0 assert(isequal(your_fcn_name(A),B)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for command is forbidden') assert(isempty(strfind(filetext, 'while')),'while command is forbidden') assert(isempty(strfind(filetext, 'find')),'find command is forbidden') assert(isempty(strfind(filetext, 'ind2sub')),'ind2sub command is forbidden')

B = 17 24 1 8 15 23 5 7 14 16 4 6 0 20 22 10 12 19 21 3 11 18 25 2 9 B = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 B = 17 24 1 8 15 23 5 7 14 16 4 6 0 20 22 10 12 19 21 3 11 18 25 2 9

8   Pass
A= 13.3; B = A; assert(isequal(your_fcn_name(A),B))

B = 13.3000 B = 13.3000