Cody

Solution 2047733

Submitted on 5 Dec 2019 by michal svec
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.3613 0.1594 0.4443 0.6587 0.1740 0.9495 0.8624 0.0867 0.8153 0.2770 0.8397 0.7835 0.0272 0.4649 0.6952 0.3996 0.9240 0.4348 0.3112 0.1924 0.1370 0.2432 0.6798 0 0.0265 0.6500 0.3135 0.7634 0.0807 0.1020 0.9245 0.2276 0.3854 0.3932 0.7316 0.4564 0.1662 0.3618 0.4703 0.3329 0.7250 0.1694 0.1027 0.1432 0.6318 0.5700 0.5310 0.3971 0.6221 0.6226 0.8263 0.7289 0.1522 0.1591 0.4356 0.3938 0.2469 0.8794 0.6927 0.9129 0.1681 0.0508 0.4394 0.9860 0.6437 0.4123 0.6626 0.6165 0.4416 0.4772 0.3825 0.2393 0.1544 0.3563 0.9717 0.3508 0.0626 0.5249 0.8565 0.1918 0.7644 0.8178 0.3058 0.0543 0.1712 0.8395 0.4768 0.7542 0.6547 0.1425 0.2608 0.5772 0.3180 0.7364 0.0024 0.2428 0.2369 0.8799 0.7161 0.1493 A(:,:,2) = 0.2081 0 0.6442 0.8127 0.3150 0.9873 0.1503 0.1458 0.5812 0.3353 0.0432 0.7103 0.6839 0.0678 0.0047 0.6932 0.9105 0.9521 0.1858 0.9545 0.3960 0.6002 0.2562 0.0038 0.0605 0.4799 0.8386 0.2999 0.4592 0.7340 0.8473 0.0312 0.8863 0.6716 0.3229 0.3794 0.0052 0.5475 0.6140 0.9303 0.0221 0.2832 0.1400 0.2116 0.0540 0.4944 0.9851 0.6483 0.6141 0.0589 0.2522 0.8979 0.7333 0.7148 0.5719 0.5672 0.1154 0.9695 0.1976 0.5942 0.0188 0.2776 0.2999 0.9534 0.2997 0.9322 0.1234 0.1324 0.4959 0.1609 0.1809 0.5311 0.4585 0.8083 0.4645 0.5624 0.7910 0.5255 0.8920 0.5072 0.6650 0.9458 0.6408 0.4708 0.5752 0.0459 0.5921 0.9615 0.0290 0.4938 0.5313 0.1152 0.6741 0.5525 0.6227 0.3337 0.9300 0.6516 0.0222 0.5848 A(:,:,3) = 0.1555 0.3697 0.0221 0.7343 0.0047 0.5469 0.0406 0.5852 0.0916 0.1696 0.6257 0.3579 0.7211 0.3505 0.6347 0.2364 0.3837 0.4062 0.6282 0.4088 0.2413 0.9811 0.2040 0.7525 0.3280 0.7479 0.8553 0.5560 0.8797 0.8245 0.1209 0.0450 0.7723 0.5182 0.0822 0.4713 0.1755 0.2866 0.1172 0.1165 0.2948 0.8069 0.6936 0.9710 0.5613 0 0.6592 0.6186 0.0062 0.5629 0.2192 0.7078 0.4535 0.6112 0.1841 0.1886 0.3255 0.4343 0.2712 0.2411 0.8576 0.6921 0.8188 0.2378 0.9694 0.8321 0.0059 0.1975 0.6631 0.0862 0.2226 0.7661 0.5438 0.5685 0.5346 0.7859 0.5930 0.2195 0.8930 0.8595 0.0852 0.5826 0.4766 0.5203 0.9802 0.5451 0.9781 0.8825 0.7703 0.1346 0.5116 0.0814 0.1703 0.6398 0.3022 0.5515 0.5022 0.3975 0.2439 0.4310 A(:,:,4) = 0.8472 0.9335 0.4340 0.5959 0.2091 0.7179 0.1282 0.5179 0.5633 0.2832 0.6220 0.6025 0.5778 0.4028 0.5518 0.8318 0.0084 0.3975 0.8053 0.7899 0.6310 0.6112 0.3597 0.0657 0.1429 0.7879 0.2454 0.6440 0.7376 0.9480 0.9226 0.5679 0.7026 0.2118 0.7317 0.4705 0.6218 0.8659 0.7042 0.0410 0.8247 0.5528 0.6313 0.1664 0.0671 0.3251 0.1633 0.9320 0.1540 0.2739 0.8916 0.0126 0.9911 0.0360 0.5368 0.4249 0.4832 0.4898 0.9763 0.7722 0.9960 0.6778 0.2765 0.5735 0.0918 0.6937 0.5813 0.0506 0.6653 0.0091 0.7560 0.6338 0.5812 0.5668 0.2690 0.5617 0.2904 0.0231 0.8338 0.7151 0.4674 0.3357 0.0471 0.0088 0.0956 0.1049 0.5151 0.0369 0.7927 0.9949 0.2596 0.1965 0.4371 0.3498 0.4488 0.5861 0.7382 0.7778 0.6884 0.6381 A(:,:,5) = 0.4996 0.3130 0.2457 0.5336 0.0057 0.7461 0.8262 0.5175 0.6679 0.8871 0.9540 0.1646 0.1255 0.3171 0.1449 0.3937 0.4972 0.4055 0.0954 0.1899 0.5272 0.4149 0.9869 0.8265 0.4904 0.8374 0.0188 0.0652 0.7591 0.8143 0.5354 0.5073 0.6984 0.6516 0.1376 0.7527 0.5510 0.9287 0.4604 0.0156 0.2257 0.1870 0.5881 0.4758 0.0842 0.4939 0.4482 0.7834 0.9911 0.8874 0.4643 0.9370 0.9559 0.9489 0.7543 0.6023 0.6291 0.6640 0.1164 0.2029 0.7201 0.4221 0.0131 0.4815 0.0609 0.0131 0.1842 0.3365 0.2506 0.5509 0.0909 0.3875 0.4726 0.1955 0.3985 0.6659 0.1418 0.7830 0.4855 0.9135 0.7405 0.4470 0.2887 0.2941 0.7275 0.0239 0.5063 0.2677 0.2351 0.4838 0.8153 0.7077 0.0201 0.7769 0.1402 0.4956 0.9343 0.3421 0.9026 0.0672 A(:,:,6) = 0.9326 0.9678 0.6009 0.4568 0.6356 0.0659 0.5941 0.0805 0.8070 0.8552 0.1755 0.8919 0.5474 0.1205 0.0660 0.4834 0.9510 0.0669 0.7385 0.8223 0.6786 0.8894 0.2520 0.4051 0.6806 0.8273 0.8142 0.8978 0.7784 0.4267 0.7175 0.5075 0.4933 0.2135 0.4887 0.3854 0.1558 0.5016 0.3480 0.8251 0.3395 0.9674 0.3671 0.1634 0.4142 0.0211 0.3846 0.5933 0.4905 0.2693 0.9885 0.7528 0.4120 0.6052 0.4242 0.6544 0.7405 0.1992 0.7557 0.2370 0.4092 0.8459 0.6282 0.3355 0.3289 0.9014 0.3753 0.9760 0.7764 0.4130 0.3092 0.8994 0.5406 0.8768 0.7404 0.8465 0.8202 0.3247 0.8110 0.9483 0.5477 0.4185 0.0646 0.2601 0.5097 0.2759 0.6638 0.5948 0.9660 0.9175 0.3884 0.5061 0.1280 0.9805 0.3326 0.1176 0.5638 0.3623 0.6995 0.8516 A(:,:,7) = 0.7585 0.0669 0.6012 0.5431 0.7773 0.3313 0.8801 0.0139 0.4312 0.6176 0.1238 0.9417 0.7175 0.3207 0.5896 0.0240 0.3453 0.6062 0.4963 0.3371 0.5487 0.1191 0.9565 0.1985 0.2500 0.4032 0.5281 0.4007 0.6987 0.1817 0.4619 0.7905 0.1197 0.4254 0.4475 0.9192 0.3509 0.0602 0.4893 0.8033 0.5188 0.6934 0.8538 0.1689 0.1614 0.8731 0.6956 0.3793 0.7806 0.2378 0.5443 0.4782 0.1898 0.0509 0.2797 0.8009 0.6488 0.6825 0.1701 0.7325 0.7827 0.2080 0.4700 0.3151 0.4192 0.7100 0.7884 0.0490 0.0093 0.6947 0.7824 0.1045 0.1777 0.3963 0.3595 0.3762 0.6261 0.5421 0.1901 0.9163 0.1815 0.5635 0.5963 0.8115 0.7975 0.1047 0.1034 0.4997 0.5206 0.0176 0.9751 0.0780 0.9621 0.2870 0.6698 0.3744 0.6880 0.3232 0.9188 0.4892 A(:,:,8) = 0.2806 0.4505 0.0593 0.4467 0.2328 0.1737 0.8080 0.2278 0.3190 0.3510 0.1977 0.5421 0.1813 0.1469 0.2655 0.6680 0.5238 0.5391 0.7741 0.3383 0.5151 0.7683 0.4969 0.8454 0.4525 0.0200 0.5179 0.4154 0.3361 0.2828 0.8611 0.0758 0.9030 0.8116 0.0444 0.9198 0.1403 0.6829 0.4902 0.3046 0.1964 0.7825 0.5085 0.2119 0.1052 0.6399 0.3449 0.6025 0.4810 0.9960 0.9165 0.0737 0.9361 0.3007 0.5804 0.7983 0.7375 0.3021 0.2538 0.8194 0.2856 0.7256 0.6473 0.0619 0.5980 0.5004 0.5403 0.3831 0.8490 0.1779 0.3815 0.0259 0.5213 0.4374 0.2497 0.6965 0.0324 0.8530 0.1888 0.5108 0.5604 0.3986 0.7315 0.4941 0.1554 0.8398 0.4126 0.7636 0.3551 0.7826 0.2953 0.4697 0.8262 0.6952 0.6741 0.1921 0.5298 0.6357 0.4707 0.2899 A(:,:,9) = 0.4271 0.0863 0.6720 0.8060 0.0842 0.0504 0.2237 0.6219 0.4871 0.5340 0.2461 0.0699 0.0516 0.9109 0.2849 0.1306 0.0783 0.5052 0.0732 0.8047 0.4644 0.2437 0.3173 0.6457 0.3550 0.4370 0.8725 0.2586 0.9811 0.4298 0.3795 0.0640 0.0485 0.0244 0.8425 0.9825 0.3725 0.3526 0.4991 0.8828 0.0967 0.6662 0.6936 0.0891 0.1545 0.5924 0.0395 0.3166 0.7554 0.7390 0.0556 0.3108 0.1490 0.9353 0.1705 0.8428 0.6875 0.6616 0.0096 0.1466 0.5874 0.3568 0.6411 0.5849 0.4719 0.6014 0.4562 0.5287 0.3654 0.4922 0.7034 0.5913 0.2287 0.2081 0.9309 0.6781 0.9561 0.2575 0.8277 0.9444 0.8089 0.7207 0.6518 0.0031 0.5131 0.2046 0.5078 0.6912 0.4782 0.6877 0.7238 0.5554 0.1403 0.3289 0.0898 0.0340 0.9409 0.9234 0.5943 0.7092 A(:,:,10) = 0.3215 0.7628 0.1829 0.2061 0.8047 0.1905 0.4235 0.4256 0.1426 0.6280 0.7880 0.2807 0.3125 0.1996 0.1939 0.4770 0.3903 0.0103 0.4873 0.4278 0.8516 0.9736 0.8195 0.0521 0.0114 0.3854 0.6014 0.1839 0.3986 0.1038 0.3532 0.1116 0.7813 0.0849 0.0289 0.4550 0.2315 0.4476 0.4369 0.8122 0.6069 0.7112 0.2328 0.7746 0.6312 0.2444 0.6881 0.9278 0.3323 0.6126 0.0290 0.3258 0.0166 0.1024 0.5089 0.6793 0.6542 0.0299 0.0326 0.5189 0.2383 0.6728 0.9544 0.1577 0.7219 0.9676 0.9120 0.6052 0.8127 0.8811 0.2001 0.2977 0.3633 0.7596 0.6974 0.9705 ...

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