Cody

Solution 1994280

Submitted on 28 Oct 2019 by William Katzianer
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.1858 0.3988 0.1549 0.7855 0.2628 0.8084 0.8031 0.5793 0.5123 0.7793 0.4116 0.2677 0.0709 0.4761 0.5159 0.7050 0.4261 0.6445 0.9574 0.0393 0.9317 0.1470 0.0234 0 0.2885 0.1172 0.5460 0.3398 0.2642 0.1286 0.1739 0.7334 0.1476 0.5279 0.3113 0.2766 0.6903 0.0179 0.9329 0.0548 0.2028 0.9367 0.2415 0.6628 0.0969 0.9658 0.9266 0.3550 0.7706 0.4372 0.7085 0.2641 0.6389 0.6033 0.4994 0.3780 0.6838 0.3487 0.9213 0.3520 0.3449 0.3028 0.5100 0.1025 0.6632 0.6515 0.4441 0.2053 0.8161 0.0292 0.2833 0.6898 0.8300 0.1811 0.5221 0.6534 0.1593 0.0852 0.1348 0.2213 0.1974 0.5749 0.7115 0.0285 0.3985 0.5250 0.0170 0.3621 0.8492 0.5918 0.9839 0.9027 0.0476 0.1916 0.3580 0.9179 0.4435 0.2272 0.8050 0.0984 B(:,:,2) = 0.9452 0 0.6100 0.9044 0.8036 0.2674 0.9984 0.1528 0.5776 0.2640 0.4438 0.5044 0.2743 0.6551 0.2055 0.4730 0.3861 0.2854 0.4883 0.7941 0.7114 0.0756 0.1812 0.4019 0.3491 0.5167 0.2670 0.4709 0.2052 0.5759 0.6540 0.4617 0.8366 0.9539 0.4163 0.3573 0.7940 0.4029 0.5601 0.1161 0.1186 0.3542 0.7729 0.4042 0.8442 0.3051 0.4551 0.4156 0.5558 0.5225 0.4867 0.9349 0.3336 0.3743 0.9070 0.8564 0.0374 0.9579 0.5172 0.5920 0.7518 0.3797 0.4913 0.1969 0.7626 0.5244 0.5626 0.6080 0.1215 0.5654 0.5287 0.5088 0.1486 0.4611 0.1662 0.4306 0.8986 0.5267 0.7450 0.1832 0.5171 0.5467 0.7337 0.6647 0.1905 0.5109 0.5013 0.7489 0.6810 0.8765 0.1335 0.7897 0.6198 0.0573 0.2815 0.9152 0.9596 0.9280 0.7687 0.1601 B(:,:,3) = 0.7230 0.9189 0.2062 0.5442 0.8055 0.7704 0.4573 0.5941 0.0200 0.6049 0.3403 0.2966 0.8468 0.9408 0.4281 0.8140 0.2508 0.2154 0.8708 0.1111 0.0894 0.9393 0.2166 0.6413 0.6861 0.9777 0.3188 0.3004 0.4023 0.1951 0.3383 0.5914 0.3239 0.7066 0.6955 0.8077 0.6819 0.3896 0.4728 0.3732 0.1300 0.2225 0.2786 0.3541 0.0523 0 0.6453 0.1604 0.0587 0.0048 0.8329 0.1034 0.0298 0.5641 0.5139 0.2785 0.1961 0.7969 0.0953 0.9389 0.8124 0.9133 0.4525 0.4831 0.1409 0.6076 0.9507 0.6648 0.8770 0.3627 0.6484 0.0628 0.0473 0.1093 0.3384 0.3789 0.0529 0.0250 0.5809 0.8251 0.3566 0.1889 0.3101 0.5536 0.7525 0.3651 0.3450 0.6923 0.3200 0.8701 0.1568 0.5638 0.9416 0.5167 0.6865 0.2703 0.6308 0.0396 0.4916 0.1122 B(:,:,4) = 0.2671 0.6878 0.4166 0.7780 0.2909 0.1098 0.0715 0.3803 0.5119 0.9025 0.2981 0.6026 0.1357 0.1609 0.6394 0.0642 0.3889 0.6425 0.9160 0.5813 0.8949 0.3320 0.0002 0.4216 0.2142 0.2342 0.0859 0.6873 0.4585 0.5213 0.4655 0.0747 0.8167 0.9382 0.4501 0.3564 0.1368 0.4948 0.5002 0.8171 0.6544 0.0029 0.5577 0.9256 0.8076 0.7639 0.3520 0.5360 0.7610 0.2678 0.2621 0.1573 0.5379 0.0725 0.5375 0.0362 0.8193 0.3873 0.7436 0.2572 0.7730 0.4829 0.6018 0.2797 0.2248 0.9900 0.4341 0.2858 0.6752 0.0781 0.0141 0.2187 0.9059 0.7273 0.9376 0.5196 0.6627 0.8284 0.2180 0.9147 0.0835 0.9907 0.1591 0.2806 0.4784 0.3792 0.2416 0.1657 0.8696 0.4501 0.3849 0.7303 0.3030 0.8722 0.6855 0.5207 0.3976 0.7570 0.4843 0.2645 B(:,:,5) = 0.2611 0.3628 0.0813 0.4193 0.1769 0.5802 0.0054 0.4808 0.3900 0.7445 0.9542 0.4535 0.5126 0.1850 0.6257 0.0427 0.7120 0.6316 0.8122 0.7794 0.0990 0.5507 0.8983 0.7680 0.4862 0.4370 0.6350 0.0596 0.2879 0.7699 0.8125 0.0113 0.3737 0.4479 0.7643 0.2724 0.2100 0.7126 0.0775 0.6660 0.5761 0.5571 0.1192 0.5187 0.7206 0.2009 0.4655 0.7777 0.5025 0.8097 0.7770 0.3922 0.6312 0.9344 0.2628 0.0466 0.8750 0.8220 0.4746 0.7000 0.8809 0.2100 0.8776 0.1728 0.7200 0.5407 0.0843 0.0763 0.7239 0.2752 0.6148 0.8931 0.4840 0.4009 0.2176 0.4668 0.6203 0.3228 0.4475 0.3491 0.6200 0.5726 0.7142 0.2231 0.8564 0.7674 0.9497 0.7056 0.6783 0.6730 0.6287 0.2364 0.9670 0.2562 0.5840 0.0030 0.0907 0.9573 0.4962 0.6693 B(:,:,6) = 0.7448 0.2780 0.9249 0.2458 0.7583 0.6343 0.8903 0.5932 0.0712 0.1700 0.7798 0.3119 0.4707 0.1574 0.1111 0.9972 0.7182 0.4618 0.3549 0.6163 0.9861 0.8877 0.4576 0.7973 0.0303 0.8017 0.9107 0.8181 0.6017 0.3462 0.9719 0.1608 0.0314 0.9711 0.5404 0.8858 0.7188 0.4503 0.8852 0.0665 0.7268 0.5766 0.0435 0.0195 0.9031 0.2392 0.3153 0.6416 0.6157 0.3762 0.3143 0.5577 0.1755 0.0352 0.7734 0.4952 0.7497 0.6496 0.7580 0.5045 0.3890 0.6049 0.8315 0.6021 0.1441 0.6682 0.9985 0.1230 0.8435 0.3148 0.8936 0.9856 0.9974 0.2847 0.9319 0.2713 0.1591 0.5038 0.5683 0.9181 0.8535 0.5720 0.4280 0.3144 0.9845 0.3794 0.7981 0.2593 0.8461 0.2858 0.4538 0.6045 0.2155 0.2667 0.0854 0.2678 0.8823 0.8369 0.4062 0.5614 B(:,:,7) = 0.7635 0.5059 0.5506 0.3229 0.1196 0.6011 0.5809 0.1491 0.0816 0.7716 0.3269 0.6746 0.2180 0.7100 0.4610 0.7298 0.0860 0.6823 0.2952 0.3845 0.9947 0.7240 0.1232 0.8474 0.4234 0.2563 0.1961 0.2701 0.7945 0.9526 0.3572 0.9537 0.7914 0.7375 0.8077 0.4204 0.5777 0.0790 0.7801 0.3393 0.3060 0.1062 0.8738 0.2829 0.7411 0.2493 0.4329 0.2707 0.8753 0.3510 0.8126 0.8327 0.1616 0.0359 0.1909 0.0805 0.2506 0.6311 0.1037 0.2044 0.0515 0.5818 0.6782 0.9886 0.7367 0.3510 0.9510 0.8163 0.5572 0.3633 0.0359 0.2005 0.5375 0.8760 0.8488 0.5248 0.0296 0.1706 0.2157 0.7888 0.0543 0.1951 0.2552 0.6710 0.1476 0.9945 0.4766 0.0905 0.0514 0.2604 0.5398 0.9271 0.9951 0.2298 0.1213 0.8920 0.7266 0.8007 0.3697 0.5420 B(:,:,8) = 0.8142 0.4344 0.0824 0.4137 0.3960 0.5748 0.0127 0.0420 0.4520 0.3848 0.6769 0.6179 0.8077 0.9919 0.4778 0.3823 0.7997 0.3913 0.3888 0.0677 0.4254 0.0479 0.6758 0.6900 0.1662 0.3412 0.3168 0.9146 0.9430 0.1606 0.7947 0.5498 0.9649 0.1754 0.3809 0.8160 0.6802 0.0767 0.3918 0.4853 0.6076 0.7620 0.1888 0.9134 0.3001 0.5330 0.7220 0.1302 0.6737 0.0531 0.9433 0.0704 0.8389 0.6975 0.2286 0.7796 0.3003 0.9934 0.9436 0.5236 0.7920 0.7181 0.2064 0.3129 0.8989 0.9676 0.3453 0.9603 0.6845 0.7992 0.9831 0.2807 0.0508 0.5345 0.9512 0.2643 0.5733 0.1983 0.5376 0.3894 0.9951 0.8622 0.8930 0.5464 0.7958 0.2283 0.2444 0.4841 0.7272 0.0846 0.4999 0.2689 0.9521 0.3560 0.7006 0.2818 0.2407 0.0200 0.0348 0.1673 B(:,:,9) = 0.2785 0.3936 0.3201 0.8210 0.3355 0.9570 0.6012 0.2073 0.7921 0.7507 0.3537 0.7413 0.9871 0.0046 0.9979 0.2197 0.4002 0.9499 0.9305 0.3801 0.5175 0.0970 0.4293 0.5082 0.3214 0.5898 0.3706 0.0094 0.8753 0.8561 0.1600 0.4964 0.4266 0.5384 0.5352 0.5395 0.7884 0.0753 0.8320 0.8207 0.9538 0.5451 0.6627 0.5240 0.7302 0.3906 0.1696 0.0126 0.2927 0.2962 0.8259 0.2236 0.3295 0.1819 0.6431 0.7455 0.4707 0.2156 0.1786 0.7838 0.8988 0.0387 0.1485 0.8915 0.4281 0.6439 0.0760 0.0939 0.0144 0.8611 0.3929 0.0588 0.3335 0.0018 0.8286 0.0095 0.9245 0.2781 0.6364 0.9185 0.2323 0.2896 0.8718 0.4905 0.6633 0.2686 0.6605 0.3991 0.3837 0.3841 0.5533 0.3607 0.2606 0.3226 0.9614 0.8675 0.4587 0.7528 0.0002 0.7186 B(:,:,10) = 0.1541 0.7793 0.6919 0.3084 0.1777 0.4032 0.4169 0.2014 0.2599 0.5132 0.5387 0.2123 0.3588 0.9777 0.9569 0.8738 0.6708 0.9894 0.8434 0.7995 0.7369 0.5865 0.7315 0.9325 0.7935 0.2817 0.7734 0.0089 0.7786 0.5739 0.4351 0.3004 0.7114 0.3453 0.4114 0.4559 0.1740 0.8112 0.9919 0.2221 0.0779 0.2188 0.6096 0.4507 0.2014 0.2353 0.3551 0.9646 0.9729 0.0508 0.9346 0.9846 0.7373 0.4765 0.9881 0.3480 0.7934 0.2607 0.4419 0.9013 0.0145 0.9574 0.7039 0.0439 0.8280 0.3699 0.8801 0.9864 0.9214 0.1893 0.6882 0.7412 0.2288 0.0244 0.0713 0.2774 ...

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