Cody

Solution 2046828

Submitted on 5 Dec 2019 by Adam Jelínek
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')

A = 15 0 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')

A = 0 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')

A = [] 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')

A = 0 0 0 0 0 8 0 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')

A(:,:,1) = 0.7180 0.4372 0.7451 0.1374 0.1450 0.4183 0.4501 0.2815 0.4881 0.1143 0.6394 0.0732 0.5345 0.6466 0.9399 0.6411 0.6328 0.7366 0.4220 0.9501 0.3344 0.0104 0.9041 0 0.9353 0.1315 0.8125 0.5501 0.4076 0.9008 0.1871 0.8854 0.7913 0.2337 0.4517 0.6415 0.8807 0.6082 0.8713 0.6949 0.0083 0.6948 0.9974 0.0160 0.2721 0.4360 0.4012 0.2726 0.5317 0.6316 0.5397 0.9602 0.8484 0.8994 0.5938 0.3537 0.2350 0.3339 0.1837 0.4316 0.0429 0.3607 0.8885 0.3554 0.9430 0.9830 0.5343 0.2993 0.2240 0.3662 0.1363 0.9811 0.5283 0.3608 0.8381 0.8064 0.8602 0.1868 0.7400 0.3986 0.5282 0.7816 0.7645 0.7868 0.5688 0.7930 0.3160 0.1884 0.3564 0.9308 0.3918 0.1659 0.3486 0.7552 0.1252 0.3659 0.8720 0.6449 0.5874 0.6084 A(:,:,2) = 0.6546 0 0.7004 0.6426 0.4816 0.0032 0.2249 0.0382 0.7835 0.7003 0.1929 0.9599 0.2719 0.2823 0.7194 0.6916 0.1999 0.2392 0.7088 0.1446 0.9928 0.2746 0.9080 0.1843 0.9266 0.7244 0.9136 0.5770 0.5626 0.3587 0.5134 0.5026 0.5825 0.5671 0.2699 0.6654 0.9695 0.2374 0.4625 0.5562 0.1470 0.7797 0.3911 0.6367 0.0597 0.7463 0.5245 0.4400 0.3211 0.5508 0.8184 0.5639 0.4889 0.6566 0.3242 0.4539 0.1847 0.5174 0.8933 0.9624 0.1043 0.1282 0.1876 0.6854 0.0063 0.1221 0.1439 0.8643 0.5453 0.3034 0.6521 0.0035 0.1726 0.8468 0.9890 0.8576 0.5461 0.0375 0.5388 0.6751 0.9477 0.6792 0.1197 0.2373 0.0500 0.1097 0.4994 0.0421 0.2647 0.0819 0.1961 0.0829 0.6230 0.4851 0.7167 0.8964 0.4684 0.2700 0.4182 0.2289 A(:,:,3) = 0.7517 0.8763 0.7663 0.8892 0.2676 0.5123 0.1733 0.0011 0.8128 0.8947 0.7943 0.7958 0.7077 0.1865 0.5193 0.2100 0.2384 0.7714 0.7080 0.1549 0.2743 0.8590 0.6054 0.4733 0.0097 0.4386 0.0030 0.1824 0.7999 0.9712 0.5928 0.9188 0.8759 0.0689 0.5144 0.5612 0.2579 0.1221 0.3997 0.5090 0.7897 0.2903 0.2007 0.4737 0.7663 0 0.6139 0.5614 0.2213 0.1668 0.8086 0.4075 0.8008 0.5135 0.7815 0.8759 0.5446 0.5866 0.8938 0.4426 0.3921 0.8738 0.9873 0.3483 0.8691 0.4215 0.8904 0.0966 0.0804 0.4521 0.8060 0.8966 0.5592 0.6150 0.7260 0.4039 0.5874 0.5609 0.1461 0.9482 0.7892 0.0752 0.6188 0.5271 0.2193 0.3207 0.8308 0.5090 0.0042 0.0467 0.6923 0.6757 0.9204 0.9246 0.8480 0.0545 0.6146 0.4482 0.1761 0.7101 A(:,:,4) = 0.0984 0.4505 0.6898 0.8747 0.8611 0.9533 0.3855 0.2486 0.1519 0.7237 0.6947 0.0013 0.5360 0.0473 0.3749 0.7305 0.8055 0.1802 0.1273 0.4858 0.5611 0.8627 0.4976 0.2459 0.6474 0.1716 0.5764 0.5103 0.0208 0.8232 0.7386 0.6238 0.0983 0.1767 0.5046 0.1733 0.0262 0.8020 0.0642 0.2362 0.5360 0.4549 0.0186 0.6504 0.2524 0.7620 0.5235 0.9162 0.8246 0.9230 0.6755 0.1354 0.3464 0.2501 0.9602 0.8514 0.3701 0.8865 0.8546 0.0419 0.6606 0.4275 0.6488 0.5324 0.6216 0.0874 0.9702 0.9637 0.1407 0.5753 0.5629 0.8441 0.0470 0.8356 0.8907 0.5511 0.8458 0.4022 0.2217 0.2781 0.8620 0.1508 0.4774 0.1280 0.6600 0.9288 0.7864 0.7158 0.6913 0.1028 0.9956 0.7236 0.9913 0.0626 0.1014 0.3250 0.4270 0.8631 0.9165 0.9080 A(:,:,5) = 0.6639 0.5676 0.9550 0.1825 0.3924 0.7240 0.4526 0.3458 0.8284 0.7065 0.6160 0.9392 0.1777 0.9086 0.5060 0.2097 0.6566 0.4615 0.9791 0.5186 0.9750 0.0864 0.2929 0.8409 0.3610 0.3676 0.5585 0.7101 0.5915 0.9608 0.3530 0.5652 0.3850 0.2058 0.4490 0.8161 0.7239 0.1475 0.7155 0.3146 0.1593 0.5751 0.2702 0.6843 0.0831 0.9653 0.1544 0.2230 0.4803 0.7827 0.4682 0.4298 0.5746 0.6430 0.3165 0.4212 0.4799 0.7104 0.7685 0.1338 0.2356 0.2639 0.9377 0.9591 0.3052 0.8606 0.6542 0.4496 0.5674 0.5881 0.8044 0.1131 0.0511 0.8288 0.2220 0.4604 0.1264 0.1455 0.1287 0.0970 0.0205 0.9089 0.8912 0.0227 0.7490 0.8286 0.3420 0.9699 0.3082 0.5130 0.5933 0.2877 0.7622 0.2453 0.9850 0.0624 0.9496 0.9711 0.2861 0.8410 A(:,:,6) = 0.1705 0.0733 0.2128 0.5184 0.0551 0.1088 0.3716 0.5694 0.3062 0.7363 0.1782 0.9868 0.4277 0.8205 0.1794 0.7170 0.4027 0.1075 0.7394 0.7377 0.1750 0.3263 0.4099 0.6112 0.6756 0.2289 0.3943 0.2633 0.9976 0.0746 0.3705 0.6456 0.2004 0.7400 0.0510 0.8431 0.8496 0.9547 0.9668 0.9746 0.0931 0.7829 0.9241 0.8478 0.9934 0.2763 0.5580 0.7824 0.2149 0.0642 0.5045 0.0372 0.0827 0.8093 0.1568 0.2098 0.7873 0.8867 0.0372 0.1305 0.9358 0.8534 0.0892 0.5433 0.6374 0.5660 0.3463 0.3065 0.8280 0.3059 0.2830 0.2145 0.6606 0.1921 0.1033 0.8607 0.0893 0.3327 0.1423 0.6932 0.0414 0.5103 0.7421 0.0654 0.0373 0.3744 0.1312 0.3779 0.2841 0.3994 0.0109 0.4119 0.4180 0.0730 0.9885 0.5477 0.4479 0.0179 0.7021 0.0446 A(:,:,7) = 0.1516 0.2351 0.5618 0.5049 0.6571 0.1108 0.2424 0.7366 0.8510 0.0844 0.3331 0.3035 0.9242 0.0779 0.6542 0.4644 0.7184 0.1714 0.5097 0.3224 0.9874 0.8871 0.6026 0.1270 0.3156 0.3431 0.5243 0.4525 0.7063 0.5370 0.8834 0.8660 0.2112 0.8647 0.8472 0.6365 0.9827 0.0153 0.1127 0.4559 0.5625 0.4821 0.3548 0.3284 0.5619 0.9486 0.4540 0.7911 0.9973 0.0631 0.0191 0.7062 0.4298 0.9892 0.5292 0.6944 0.9596 0.9331 0.8010 0.6634 0.0310 0.7015 0.1444 0.5730 0.7292 0.0929 0.3205 0.0576 0.8813 0.5396 0.7092 0.3293 0.6397 0.7867 0.4700 0.6615 0.5544 0.5621 0.2929 0.0804 0.8448 0.9274 0.3179 0.5914 0.4780 0.4854 0.2221 0.8494 0.2699 0.4939 0.1584 0.4630 0.7613 0.4260 0.8295 0.7363 0.9910 0.6187 0.3706 0.1421 A(:,:,8) = 0.1421 0.3401 0.0573 0.4948 0.9513 0.4757 0.4523 0.2569 0.0105 0.6523 0.4658 0.3210 0.6820 0.6068 0.5560 0.5437 0.2294 0.8779 0.3101 0.2961 0.4081 0.6565 0.2929 0.2331 0.6302 0.7652 0.8205 0.6896 0.4616 0.7603 0.7937 0.6266 0.8512 0.6365 0.9924 0.4605 0.8717 0.1855 0.3217 0.1494 0.3971 0.6295 0.0852 0.5479 0.8060 0.1059 0.3488 0.1086 0.3459 0.7939 0.6088 0.4425 0.5020 0.8466 0.3325 0.6894 0.0140 0.4089 0.2418 0.1331 0.2081 0.7512 0.7545 0.2667 0.9134 0.2538 0.5409 0.1411 0.3349 0.7733 0.4365 0.1901 0.7977 0.1229 0.6733 0.4202 0.0821 0.7715 0.9799 0.3401 0.3170 0.9191 0.5119 0.3150 0.5175 0.3128 0.5563 0.4003 0.8219 0.1872 0.2142 0.8192 0.1293 0.0219 0.0183 0.9409 0.1496 0.0709 0.6680 0.6088 A(:,:,9) = 0.2253 0.0897 0.7060 0.8898 0.9555 0.6561 0.5046 0.9845 0.3165 0.2713 0.2592 0.5400 0.5145 0.9070 0.3139 0.1805 0.2615 0.5702 0.8387 0.1922 0.4484 0.4631 0.8458 0.2713 0.8028 0.1887 0.8526 0.3280 0.4706 0.2794 0.5930 0.0647 0.5436 0.5352 0.8034 0.3471 0.6942 0.9481 0.0615 0.9650 0.2222 0.8925 0.6429 0.1940 0.4614 0.7103 0.8358 0.5416 0.4368 0.9491 0.2402 0.4266 0.3578 0.5515 0.9742 0.4996 0.2691 0.8831 0.4599 0.5762 0.0807 0.4393 0.1376 0.2564 0.4495 0.4406 0.0037 0.8535 0.2031 0.6260 0.7533 0.3857 0.7009 0.3956 0.8934 0.8520 0.7196 0.9523 0.3469 0.0151 0.1456 0.2945 0.8774 0.3000 0.9483 0.9275 0.8503 0.8159 0.7115 0.2568 0.0474 0.3713 0.4330 0.7374 0.2028 0.0129 0.1865 0.7894 0.8125 0.5721 A(:,:,10) = 0.9626 0.1420 0.5114 0.5222 0.5046 0.4677 0.4650 0.2564 0.5589 0.5814 0.9402 0.6416 0.3598 0.1471 0.2405 0.0542 0.6844 0.9068 0.5062 0.7567 0.8407 0.1485 0.9708 0.1779 0.5907 0.5864 0.6765 0.1794 0.6924 0.5364 0.9795 0.2245 0.1357 0.0315 0.7639 0.3794 0.7407 0.1909 0.0403 0.4995 0.5584 0.0903 0.7314 0.3153 0.1266 0.6126 0.9610 0.7031 0.8795 0.4240 0.9019 0.6825 0.3574 0.2649 0.4280 0.8526 0.0513 0.6948 0.7636 0.6729 0.3186 0.3780 0.2483 0.9468 0.6851 0.0021 0.1725 0.8109 0.1273 0.8396 0.1951 0.7052 0.7887 0.6216 0.0248 0.1052 ...

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')

A = 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 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 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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 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 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 A = 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 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))

A = 13.3000 B = 13.3000