Cody

Solution 2038298

Submitted on 28 Nov 2019 by Monika Krejci
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.0990 0.9114 0.2546 0.9954 0.3566 0.4824 0.1382 0.7936 0.1751 0.7966 0.7127 0.2992 0.5404 0.7575 0.6549 0.8793 0.0782 0.6492 0.3995 0.7410 0.4465 0.9196 0.9784 0 0.5929 0.6773 0.5243 0.3626 0.8717 0.6505 0.8180 0.1112 0.3522 0.2094 0.1613 0.1918 0.7664 0.0223 0.6756 0.5731 0.4449 0.6511 0.4767 0.2930 0.9584 0.2290 0.0129 0.5483 0.3854 0.6618 0.3176 0.7425 0.4902 0.7121 0.9776 0.9532 0.8304 0.8230 0.6747 0.9813 0.9689 0.7982 0.5113 0.8531 0.9539 0.5889 0.1396 0.2851 0.9940 0.8168 0.0037 0.2158 0.0132 0.8171 0.6048 0.9824 0.3298 0.4428 0.5336 0.1825 0.8588 0.1756 0.6937 0.3914 0.6307 0.7336 0.0440 0.2363 0.0620 0.3662 0.5878 0.7013 0.3554 0.9514 0.9035 0.5926 0.1612 0.5881 0.8879 0.2669 A(:,:,2) = 0.9071 0 0.4767 0.5239 0.5470 0.4181 0.6699 0.9505 0.3499 0.0783 0.7299 0.4640 0.7951 0.2154 0.1742 0.1180 0.3805 0.0876 0.0909 0.5407 0.8086 0.1017 0.3100 0.7872 0.3643 0.0183 0.7176 0.7102 0.0160 0.0928 0.4718 0.5626 0.2756 0.5823 0.5085 0.8320 0.2236 0.9339 0.3269 0.6420 0.9530 0.8754 0.1418 0.9609 0.4162 0.2380 0.5974 0.5930 0.0823 0.0432 0.6645 0.4943 0.4515 0.5051 0.3538 0.1567 0.4331 0.0181 0.8472 0.8116 0.5208 0.3252 0.5207 0.5173 0.9821 0.1655 0.3808 0.6935 0.2869 0.4615 0.9746 0.6352 0.6009 0.2623 0.9536 0.5643 0.5494 0.7828 0.5302 0.2657 0.4454 0.2742 0.5116 0.7959 0.0667 0.5079 0.1962 0.2504 0.5414 0.3535 0.5311 0.1846 0.0165 0.3733 0.2800 0.2008 0.0477 0.7386 0.5759 0.9106 A(:,:,3) = 0.9318 0.0853 0.8285 0.9533 0.1945 0.6492 0.2528 0.7912 0.8444 0.6692 0.3075 0.6836 0.8734 0.9459 0.3697 0.7576 0.8585 0.6473 0.1710 0.9925 0.8182 0.5535 0.8424 0.9737 0.4672 0.8774 0.2300 0.7843 0.5588 0.9416 0.5241 0.9601 0.5485 0.6124 0.6380 0.3788 0.0585 0.8832 0.2965 0.9302 0.5860 0.4126 0.9930 0.2096 0.4539 0 0.2169 0.6148 0.3315 0.5080 0.7109 0.3346 0.6560 0.3141 0.2154 0.8143 0.3788 0.8348 0.1603 0.3339 0.8571 0.1602 0.4587 0.6458 0.9471 0.7158 0.0551 0.3374 0.4467 0.9641 0.0050 0.6167 0.5097 0.8350 0.6084 0.6493 0.8987 0.0748 0.3848 0.7877 0.3547 0.0943 0.6302 0.2071 0.0709 0.2035 0.9176 0.5179 0.9182 0.9163 0.5137 0.3611 0.1322 0.2127 0.2725 0.1289 0.0148 0.7261 0.2496 0.1841 A(:,:,4) = 0.6109 0.0394 0.6799 0.4072 0.8635 0.5905 0.9150 0.6393 0.8572 0.8502 0.8877 0.6771 0.7549 0.5028 0.5369 0.6821 0.4232 0.0955 0.3128 0.1762 0.7253 0.4737 0.5933 0.7599 0.9972 0.8758 0.6935 0.2753 0.6427 0.4106 0.0968 0.1639 0.4439 0.0015 0.4890 0.2130 0.0445 0.9376 0.8094 0.1649 0.9384 0.9627 0.8891 0.8734 0.5504 0.7962 0.4696 0.6108 0.6096 0.2389 0.6726 0.3202 0.8874 0.3975 0.0219 0.5341 0.3418 0.4086 0.5345 0.5925 0.3880 0.9239 0.9022 0.4536 0.6910 0.6592 0.3603 0.9778 0.9041 0.7027 0.3049 0.3847 0.3960 0.2240 0.8012 0.9893 0.0205 0.8359 0.4532 0.8292 0.9142 0.0513 0.7145 0.5894 0.0910 0.4622 0.4178 0.0430 0.8799 0.9998 0.3005 0.8699 0.1907 0.9397 0.1252 0.1071 0.6752 0.3126 0.1194 0.9015 A(:,:,5) = 0.3661 0.0227 0.9904 0.1161 0.8076 0.3929 0.5020 0.0664 0.3493 0.8166 0.7239 0.5765 0.1840 0.7033 0.6575 0.8623 0.6347 0.1652 0.8977 0.4907 0.6947 0.0123 0.6650 0.4401 0.9391 0.3620 0.9910 0.3649 0.0055 0.6995 0.4454 0.6343 0.3146 0.5533 0.3390 0.5700 0.5731 0.0150 0.1047 0.9044 0.7909 0.0327 0.9299 0.8576 0.5728 0.6561 0.6605 0.2763 0.6178 0.0743 0.2825 0.4633 0.2123 0.5371 0.9606 0.5440 0.1915 0.3948 0.9477 0.8414 0.0668 0.1975 0.6026 0.2455 0.3659 0.3638 0.2116 0.9713 0.1698 0.3871 0.0212 0.8698 0.2254 0.4378 0.2203 0.2205 0.4372 0.9033 0.5300 0.8949 0.8913 0.3961 0.1634 0.8806 0.5234 0.2936 0.2237 0.5833 0.7813 0.5391 0.4176 0.4222 0.0367 0.1307 0.5879 0.5017 0.5503 0.6006 0.4906 0.2835 A(:,:,6) = 0.3492 0.0977 0.0754 0.1862 0.0376 0.2428 0.9953 0.3969 0.9053 0.8423 0.4957 0.5168 0.7791 0.0465 0.3968 0.9828 0.6303 0.4387 0.9689 0.7096 0.4806 0.0598 0.6438 0.6233 0.4141 0.2818 0.0569 0.8461 0.4249 0.5178 0.0188 0.9105 0.9644 0.4681 0.5575 0.5000 0.0638 0.3107 0.1628 0.2997 0.8273 0.9270 0.3037 0.9167 0.0992 0.2524 0.7261 0.1257 0.2936 0.6279 0.6217 0.8048 0.1251 0.7530 0.2801 0.7732 0.0408 0.2308 0.3009 0.9067 0.6104 0.0959 0.5108 0.0608 0.5212 0.2528 0.6915 0.0493 0.1403 0.3752 0.2592 0.4402 0.6935 0.0698 0.1211 0.7435 0.0067 0.4422 0.2753 0.2397 0.8533 0.8823 0.9055 0.0107 0.0986 0.2640 0.6133 0.2120 0.3538 0.8635 0.1710 0.7805 0.8929 0.9010 0.5856 0.6891 0.2664 0.6404 0.9042 0.1202 A(:,:,7) = 0.3432 0.1615 0.2806 0.7236 0.2074 0.9275 0.2369 0.0041 0.0302 0.3324 0.7433 0.9868 0.1317 0.6567 0.2229 0.7494 0.6865 0.4268 0.8433 0.5806 0.9963 0.6954 0.8221 0.5995 0.3017 0.0577 0.1973 0.0563 0.9554 0.5027 0.2544 0.2712 0.6249 0.3728 0.8780 0.8191 0.5473 0.5492 0.1674 0.2983 0.6707 0.1234 0.5500 0.3990 0.7986 0.8330 0.3385 0.5605 0.8958 0.4164 0.9350 0.6648 0.7355 0.2478 0.3473 0.9958 0.2194 0.4212 0.0470 0.6745 0.7585 0.5418 0.2822 0.8881 0.0478 0.9360 0.4999 0.1105 0.3254 0.4583 0.1639 0.1093 0.8663 0.3362 0.3775 0.5197 0.6035 0.5580 0.6481 0.2051 0.9473 0.8582 0.4195 0.4460 0.3619 0.2519 0.9555 0.1638 0.9322 0.0209 0.4167 0.1553 0.3175 0.2436 0.5074 0.3690 0.3522 0.0349 0.4706 0.7975 A(:,:,8) = 0.5590 0.8948 0.4598 0.0041 0.7888 0.0017 0.4079 0.2399 0.9207 0.8443 0.1113 0.3412 0.0317 0.6560 0.8086 0.1801 0.5882 0.3039 0.7971 0.5277 0.1029 0.6221 0.8676 0.9384 0.4626 0.6374 0.4455 0.3237 0.9311 0.7795 0.2890 0.7110 0.7721 0.9975 0.2346 0.8002 0.7117 0.6990 0.7656 0.5543 0.3746 0.8155 0.0351 0.4989 0.3388 0.9092 0.9230 0.9540 0.8067 0.7817 0.9540 0.1126 0.6302 0.7817 0.3034 0.0946 0.6715 0.8379 0.2129 0.3500 0.7850 0.5913 0.2842 0.9531 0.4410 0.4500 0.4401 0.2835 0.5451 0.7598 0.3061 0.1110 0.2800 0.4277 0.2341 0.1905 0.0405 0.2164 0.2158 0.6652 0.7962 0.9805 0.8800 0.9713 0.3047 0.9107 0.5722 0.9982 0.7275 0.7321 0.6050 0.2843 0.5313 0.4077 0.5848 0.4745 0.6413 0.0084 0.4265 0.4739 A(:,:,9) = 0.0587 0.4043 0.5254 0.3745 0.3135 0.5046 0.0051 0.6445 0.1508 0.2109 0.6722 0.3274 0.6114 0.4257 0.8337 0.7609 0.7607 0.4687 0.0410 0.3682 0.9132 0.1878 0.4201 0.3564 0.3339 0.3603 0.1150 0.1070 0.6319 0.6440 0.8726 0.9359 0.5136 0.7576 0.4975 0.8950 0.4309 0.4502 0.0704 0.1939 0.5927 0.1346 0.3907 0.3506 0.2809 0.8786 0.8245 0.7579 0.2318 0.0370 0.5899 0.7581 0.1192 0.9412 0.2337 0.3414 0.9485 0.6310 0.2648 0.8674 0.4574 0.8090 0.4278 0.3941 0.9868 0.9199 0.0004 0.8028 0.5619 0.3081 0.1455 0.2164 0.1357 0.0583 0.8913 0.0838 0.9158 0.1879 0.9882 0.1251 0.9898 0.1855 0.3142 0.9578 0.4436 0.0895 0.4334 0.4829 0.5412 0.7849 0.5864 0.2287 0.4833 0.9806 0.9173 0.6379 0.0460 0.6107 0.4886 0.6828 A(:,:,10) = 0.7479 0.8644 0.8699 0.7303 0.5959 0.9160 0.3320 0.7165 0.9619 0.1552 0.1873 0.3534 0.2542 0.9843 0.7200 0.8247 0.6516 0.0223 0.5774 0.7637 0.3413 0.0773 0.7561 0.4112 0.4935 0.7590 0.6277 0.8081 0.5641 0.0340 0.1183 0.5017 0.0073 0.5207 0.5932 0.1544 0.2843 0.9024 0.7865 0.7437 0.8232 0.1784 0.4453 0.1792 0.6813 0.1364 0.7708 0.2575 0.5867 0.7055 0.1272 0.0055 0.6000 0.2094 0.8826 0.9655 0.1591 0.0136 0.8752 0.8773 0.0622 0.1104 0.3320 0.0576 0.4707 0.3614 0.9593 0.7850 0.4150 0.3013 0.7877 0.0684 0.0859 0.1555 0.9995 0.9409 ...

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