Cody

Solution 1591442

Submitted on 25 Jul 2018 by Marco Tullio
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 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 = 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 = []

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 = 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.8444 0.4321 0.7025 0.4036 0.6943 0.1939 0.2072 0.0965 0.4529 0.4209 0.6569 0.6423 0.0337 0.4403 0.2788 0.6641 0.9038 0.6439 0.4096 0.9660 0.6543 0.3386 0.7448 0 0.1739 0.8883 0.5865 0.2394 0.4700 0.7292 0.6609 0.1009 0.8105 0.1547 0.2597 0.7088 0.4446 0.1898 0.6549 0.7741 0.9672 0.3764 0.8956 0.9587 0.5549 0.0145 0.0771 0.3757 0.8061 0.7498 0.0812 0.7570 0.5529 0.9483 0.8535 0.5342 0.2769 0.4895 0.0841 0.0159 0.4430 0.3682 0.9633 0.1532 0.2197 0.2355 0.6215 0.3908 0.4208 0.9011 0.3687 0.4247 0.9653 0.1499 0.4093 0.3181 0.1476 0.1581 0.6432 0.5482 0.5005 0.4861 0.8726 0.7951 0.6867 0.4945 0.7724 0.2868 0.1794 0.7866 0.4393 0.6455 0.8644 0.6552 0.1155 0.5475 0.9407 0.2900 0.0092 0.2372 B(:,:,2) = 0.9405 0 0.2375 0.5427 0.2143 0.9326 0.0544 0.4852 0.5624 0.5101 0.5491 0.6119 0.8883 0.1427 0.0996 0.6787 0.1852 0.1041 0.9863 0.2121 0.7375 0.9447 0.1098 0.5251 0.9403 0.1070 0.0041 0.8387 0.2018 0.2464 0.4456 0.4694 0.6144 0.5959 0.0377 0.3093 0.4005 0.2223 0.3292 0.6280 0.2181 0.0801 0.7624 0.5578 0.6836 0.6113 0.3785 0.2592 0.9430 0.5954 0.2576 0.6638 0.8714 0.2535 0.7536 0.2413 0.9056 0.5760 0.8761 0.9294 0.0053 0.6891 0.3906 0.6243 0.3217 0.7001 0.6709 0.9828 0.5901 0.3898 0.4179 0.4740 0.7483 0.2129 0.5016 0.4018 0.9866 0.3672 0.4833 0.2234 0.6190 0.4105 0.3591 0.4759 0.9645 0.4297 0.9860 0.8548 0.4716 0.9432 0.5424 0.4766 0.5357 0.1294 0.5195 0.7802 0.6066 0.9139 0.9661 0.6376 B(:,:,3) = 0.7584 0.6624 0.4425 0.3817 0.4355 0.1550 0.9056 0.1855 0.9663 0.3797 0.5437 0.8896 0.4361 0.2100 0.0253 0.1049 0.4821 0.3005 0.4523 0.9202 0.5590 0.3821 0.7334 0.2638 0.0945 0.3191 0.1047 0.4709 0.4417 0.9129 0.9040 0.3521 0.5127 0.4783 0.8102 0.4200 0.9647 0.2778 0.0537 0.0563 0.5806 0.9613 0.8417 0.0144 0.9614 0 0.8128 0.3448 0.8318 0.6963 0.7183 0.5582 0.1064 0.4176 0.0853 0.0559 0.2832 0.6423 0.4315 0.1066 0.6416 0.2849 0.5769 0.4787 0.1774 0.6401 0.9238 0.0927 0.8263 0.8260 0.2359 0.5114 0.4093 0.9742 0.5950 0.2299 0.9968 0.4112 0.1179 0.3888 0.1327 0.2781 0.0558 0.5334 0.6733 0.2147 0.6216 0.4526 0.6024 0.6714 0.0814 0.4269 0.4847 0.9687 0.9623 0.0719 0.9830 0.7048 0.1333 0.2255 B(:,:,4) = 0.5377 0.6589 0.6084 0.1222 0.9606 0.4044 0.8037 0.8902 0.3379 0.7930 0.3438 0.6324 0.7420 0.1954 0.2735 0.8892 0.7639 0.7074 0.9453 0.3643 0.3611 0.0773 0.5135 0.7505 0.3643 0.1217 0.0617 0.2461 0.8893 0.2348 0.7259 0.8457 0.0913 0.2829 0.7252 0.0765 0.9373 0.5649 0.5006 0.3449 0.1492 0.8335 0.2255 0.4546 0.9766 0.3386 0.9054 0.7165 0.7399 0.3458 0.6764 0.1239 0.2489 0.4359 0.4774 0.0974 0.1159 0.8230 0.9382 0.5830 0.3870 0.5226 0.5335 0.1511 0.4841 0.3681 0.4467 0.6687 0.7894 0.1307 0.0958 0.5052 0.6985 0.7489 0.4448 0.5604 0.1478 0.4560 0.7552 0.9657 0.4292 0.2240 0.3651 0.7862 0.6355 0.5209 0.0354 0.8446 0.2600 0.1387 0.3676 0.2006 0.2233 0.4886 0.2151 0.9585 0.2270 0.0008 0.0966 0.3445 B(:,:,5) = 0.6809 0.4428 0.1833 0.9419 0.5984 0.1907 0.5860 0.4677 0.2216 0.1342 0.0112 0.1712 0.0434 0.1663 0.7173 0.1149 0.0404 0.1663 0.8281 0.7687 0.4325 0.4033 0.2526 0.3718 0.8438 0.4218 0.2491 0.5364 0.4324 0.9946 0.1796 0.6450 0.7283 0.8550 0.2654 0.1102 0.3264 0.7139 0.4724 0.8634 0.4852 0.4279 0.6022 0.9903 0.1222 0.7511 0.1822 0.2526 0.3177 0.6813 0.5027 0.2011 0.9521 0.5581 0.1053 0.1277 0.6349 0.8949 0.0690 0.3982 0.3740 0.8215 0.7930 0.0108 0.4376 0.6487 0.5819 0.8489 0.5637 0.9607 0.6332 0.8287 0.2454 0.8475 0.4901 0.5254 0.9451 0.5340 0.2662 0.7267 0.6274 0.8103 0.4822 0.9948 0.7870 0.7992 0.7395 0.2029 0.3127 0.5706 0.8379 0.0471 0.9701 0.0849 0.9442 0.8602 0.3825 0.9339 0.1857 0.3879 B(:,:,6) = 0.8685 0.6957 0.5006 0.9607 0.4480 0.8709 0.8774 0.9356 0.2654 0.2945 0.2752 0.5403 0.7130 0.3151 0.7108 0.2806 0.8923 0.2130 0.0845 0.0091 0.5459 0.4009 0.0810 0.9676 0.6569 0.4577 0.5846 0.6758 0.7337 0.2523 0.4208 0.2789 0.9592 0.7097 0.9085 0.0714 0.1805 0.2570 0.0073 0.9367 0.1133 0.8677 0.5121 0.0769 0.1517 0.5737 0.3833 0.8522 0.2695 0.4100 0.2500 0.2138 0.7742 0.5671 0.9520 0.7992 0.3537 0.1538 0.3879 0.9208 0.8045 0.0571 0.3037 0.3434 0.2109 0.4830 0.4285 0.1787 0.4501 0.6398 0.4286 0.3804 0.7891 0.4196 0.1613 0.3689 0.5423 0.3668 0.0357 0.8130 0.9403 0.0135 0.4187 0.8529 0.9272 0.7801 0.1673 0.7021 0.5120 0.2442 0.0915 0.4281 0.0791 0.9641 0.8951 0.8868 0.9176 0.9117 0.5807 0.2028 B(:,:,7) = 0.9040 0.8895 0.4850 0.4218 0.0483 0.0600 0.2582 0.1235 0.7397 0.8889 0.1402 0.4220 0.0638 0.2338 0.1315 0.7195 0.1564 0.6240 0.4855 0.3256 0.4213 0.9346 0.0137 0.4416 0.5650 0.1608 0.5811 0.9663 0.4777 0.6120 0.1471 0.0642 0.4661 0.3808 0.9332 0.3534 0.8788 0.2519 0.3431 0.2994 0.8832 0.9487 0.5264 0.5802 0.7919 0.4985 0.9111 0.5937 0.6184 0.2284 0.5367 0.2274 0.9491 0.4854 0.0615 0.5305 0.9573 0.3992 0.2260 0.7351 0.6919 0.1468 0.6939 0.0739 0.9769 0.7568 0.5402 0.5646 0.1400 0.9811 0.2538 0.5419 0.2800 0.6915 0.1601 0.3442 0.2232 0.9496 0.5575 0.1262 0.8019 0.1442 0.7582 0.6392 0.7845 0.4453 0.0108 0.5106 0.6658 0.1465 0.5757 0.6015 0.9893 0.4816 0.5639 0.9498 0.7164 0.7814 0.9250 0.6860 B(:,:,8) = 0.9971 0.8085 0.6960 0.0484 0.7838 0.0848 0.8727 0.4640 0.8924 0.1050 0.3862 0.9414 0.3034 0.8513 0.9668 0.0411 0.9968 0.3011 0.4644 0.8338 0.8584 0.4744 0.8627 0.2259 0.6271 0.7346 0.5057 0.1322 0.7061 0.2583 0.0061 0.7509 0.9941 0.1466 0.3093 0.7471 0.2989 0.5393 0.1897 0.0543 0.8010 0.5200 0.8837 0.9425 0.0872 0.4219 0.4078 0.2018 0.1758 0.4242 0.3289 0.4413 0.9807 0.7840 0.2146 0.2264 0.3227 0.7455 0.0311 0.7008 0.5338 0.0338 0.8645 0.2373 0.5452 0.5011 0.8479 0.5754 0.1346 0.1491 0.0728 0.9842 0.4506 0.2792 0.5895 0.3644 0.4393 0.9130 0.8420 0.5227 0.4541 0.4275 0.2523 0.3197 0.4320 0.6732 0.2199 0.2245 0.4991 0.4670 0.8165 0.7713 0.5269 0.6779 0.8892 0.2739 0.0922 0.3940 0.5939 0.8485 B(:,:,9) = 0.4538 0.0541 0.4263 0.1919 0.0433 0.5536 0.9906 0.2857 0.0420 0.7515 0.7782 0.4759 0.4768 0.2648 0.6299 0.6859 0.4053 0.1803 0.4799 0.3136 0.2781 0.4555 0.2891 0.0528 0.4667 0.8435 0.1195 0.7573 0.8466 0.0978 0.2288 0.9273 0.8524 0.3671 0.0010 0.2248 0.1040 0.7172 0.1152 0.0605 0.6540 0.6704 0.8243 0.4053 0.1336 0.2528 0.5021 0.6693 0.3581 0.4244 0.7925 0.3738 0.1317 0.7260 0.7724 0.0766 0.7556 0.4985 0.0247 0.1952 0.2902 0.3197 0.0953 0.9596 0.1018 0.8195 0.6160 0.0875 0.0864 0.4896 0.3459 0.8266 0.7711 0.5246 0.1828 0.7441 0.7892 0.6217 0.9057 0.6284 0.5290 0.0345 0.3536 0.6031 0.0953 0.0937 0.5316 0.7291 0.9583 0.1143 0.7226 0.3760 0.6838 0.4888 0.3219 0.4338 0.7868 0.5655 0.1602 0.9654 B(:,:,10) = 0.6965 0.9796 0.0335 0.8654 0.0770 0.7922 0.4294 0.1554 0.4341 0.1455 0.0614 0.5612 0.6552 0.8325 0.5492 0.1858 0.6122 0.4474 0.4001 0.2724 0.6935 0.1326 0.3736 0.6100 0.7842 0.3653 0.1832 0.7717 0.7533 0.2134 0.4472 0.3734 0.0081 0.4134 0.7797 0.4214 0.1890 0.1870 0.4429 0.7486 0.2977 0.9107 0.2046 0.0781 0.5697 0.8883 0.7059 0.4728 0.7665 0.2785 0.7710 0.5977 0.9675 0.3110 0.1131 0.3271 0.8523 0.7855 0.1271 0.4340 0.8063 0.2218 0.2672 0.5386 0.3635 0.2924 0.8219 0.3462 0.1265 0.9496 0.3718 0.3202 0.4106 0.7043 0.1378 0.6534 ...

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 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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

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