Cody

Solution 2044483

Submitted on 3 Dec 2019 by Michal Florek
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.3448 0.1317 0.2728 0.5899 0.3501 0.8173 0.4179 0.2240 0.6600 0.2719 0.8240 0.3530 0.1407 0.2620 0.7991 0.6701 0.3657 0.0894 0.4822 0.5244 0.9297 0.2651 0.8732 0 0.0631 0.0596 0.2732 0.4525 0.7286 0.5041 0.8939 0.4429 0.8114 0.7277 0.1959 0.4128 0.5274 0.7609 0.9345 0.5939 0.3611 0.3056 0.0924 0.1099 0.5137 0.1299 0.3483 0.6426 0.5890 0.6641 0.8777 0.5129 0.9621 0.7242 0.1186 0.4369 0.5885 0.3076 0.6458 0.6528 0.6186 0.8576 0.6420 0.1864 0.2853 0.0328 0.3637 0.8998 0.3114 0.8437 0.3622 0.3576 0.7038 0.6391 0.1125 0.4952 0.7017 0.5425 0.9036 0.8167 0.2834 0.9300 0.5541 0.0823 0.8785 0.6248 0.2933 0.7343 0.5769 0.5712 0.2606 0.0746 0.3091 0.4876 0.3654 0.4658 0.2276 0.9541 0.8579 0.1694 A(:,:,2) = 0.4263 0 0.6806 0.6944 0.7142 0.1347 0.4968 0.3444 0.9026 0.6155 0.2072 0.2107 0.9536 0.6042 0.8425 0.2602 0.2680 0.6845 0.2887 0.9993 0.1177 0.5001 0.1651 0.7625 0.1656 0.7336 0.6073 0.9236 0.1872 0.5746 0.6057 0.5492 0.0527 0.7591 0.1074 0.3514 0.8592 0.7426 0.1800 0.0673 0.6481 0.5248 0.7109 0.9657 0.7263 0.2053 0.9519 0.5653 0.1498 0.8187 0.4402 0.5671 0.5604 0.5233 0.0862 0.2021 0.8113 0.3917 0.3151 0.1223 0.3002 0.0653 0.5820 0.1754 0.6115 0.6283 0.0881 0.5376 0.7222 0.6427 0.7932 0.8349 0.2537 0.5643 0.9297 0.6870 0.0370 0.2747 0.5041 0.0681 0.4630 0.5198 0.4976 0.5900 0.3997 0.0607 0.4080 0.4205 0.2628 0.5927 0.5813 0.4952 0.2729 0.2934 0.2874 0.5257 0.6008 0.6456 0.6910 0.1284 A(:,:,3) = 0.6791 0.4107 0.5216 0.6368 0.3012 0.8465 0.0851 0.9843 0.4025 0.1561 0.2716 0.1795 0.1590 0.3269 0.6144 0.6000 0.2881 0.0056 0.7550 0.5163 0.9280 0.4274 0.4104 0.0316 0.3146 0.7529 0.7012 0.1038 0.6085 0.1193 0.3252 0.6945 0.0026 0.4834 0.6981 0.2093 0.8166 0.7583 0.6736 0.4241 0.5524 0.3113 0.4032 0.2871 0.2013 0 0.3361 0.6919 0.0892 0.0729 0.2579 0.5370 0.7127 0.5820 0.6863 0.5800 0.3450 0.3079 0.0945 0.6611 0.0919 0.9184 0.0707 0.5293 0.8739 0.9496 0.7962 0.1051 0.1812 0.3996 0.7447 0.1484 0.1737 0.0573 0.9447 0.8375 0.8113 0.5140 0.9141 0.6805 0.9699 0.6768 0.9281 0.2913 0.2358 0.5299 0.2140 0.6034 0.5516 0.2469 0.0267 0.7599 0.8710 0.5124 0.1302 0.1187 0.2725 0.8657 0.7206 0.9322 A(:,:,4) = 0.9708 0.3515 0.4099 0.2875 0.7872 0.4315 0.5362 0.2860 0.0886 0.0098 0.0459 0.3002 0.7744 0.7963 0.2939 0.1148 0.0258 0.8119 0.1788 0.2615 0.9795 0.8490 0.6434 0.1302 0.8860 0.8178 0.4097 0.9693 0.0363 0.7007 0.1528 0.1025 0.4994 0.8979 0.9908 0.9298 0.5378 0.2293 0.6743 0.6572 0.9011 0.6532 0.4811 0.1973 0.6232 0.3971 0.7463 0.4435 0.5120 0.4053 0.9277 0.1511 0.8359 0.0439 0.9506 0.1363 0.8387 0.1351 0.6912 0.9412 0.0367 0.6286 0.4250 0.8347 0.9066 0.3254 0.9595 0.6920 0.3967 0.8703 0.4884 0.4110 0.6903 0.4549 0.6845 0.0991 0.9437 0.7665 0.2567 0.2814 0.9914 0.1345 0.0291 0.2192 0.3974 0.6587 0.5676 0.5892 0.2935 0.5697 0.1821 0.0735 0.2847 0.3694 0.3178 0.4909 0.7078 0.0108 0.5754 0.1720 A(:,:,5) = 0.3488 0.3400 0.1262 0.4964 0.2513 0.5436 0.7684 0.0026 0.0377 0.8233 0.4992 0.2000 0.0406 0.4796 0.9509 0.0571 0.4956 0.4749 0.8522 0.7961 0.6764 0.4792 0.4222 0.8181 0.4990 0.9296 0.3829 0.4266 0.2141 0.2263 0.6550 0.4299 0.9249 0.9151 0.2199 0.3772 0.0593 0.0599 0.9814 0.4186 0.6143 0.1283 0.1245 0.6907 0.0224 0.2704 0.0874 0.1130 0.9480 0.0474 0.8163 0.8868 0.9598 0.6304 0.7072 0.7783 0.1002 0.3013 0.8320 0.5208 0.9523 0.3080 0.0717 0.9961 0.2278 0.9074 0.5383 0.9598 0.9670 0.3130 0.5980 0.6876 0.8609 0.5735 0.4924 0.9456 0.8942 0.3434 0.2828 0.3769 0.7622 0.9534 0.3383 0.4305 0.5487 0.7293 0.7483 0.5781 0.7085 0.8390 0.3006 0.0569 0.6783 0.4182 0.7633 0.9099 0.7674 0.4735 0.7922 0.9866 A(:,:,6) = 0.9951 0.9832 0.6815 0.9776 0.9463 0.9551 0.0582 0.6030 0.7265 0.0527 0.3981 0.5715 0.4982 0.7276 0.0474 0.7109 0.1856 0.3308 0.7374 0.4074 0.5998 0.2548 0.6026 0.3079 0.9709 0.9331 0.4781 0.5103 0.5036 0.6079 0.6134 0.5055 0.0061 0.3826 0.0556 0.8384 0.3831 0.1306 0.3480 0.1915 0.9233 0.3541 0.4679 0.9101 0.0477 0.3674 0.5362 0.9012 0.6570 0.3676 0.2832 0.0429 0.8538 0.5379 0.8848 0.3144 0.1075 0.5803 0.5852 0.8475 0.2713 0.1197 0.1156 0.9479 0.9484 0.4431 0.2128 0.0052 0.4619 0.6162 0.5205 0.1189 0.3717 0.8742 0.9193 0.5987 0.7889 0.3510 0.5818 0.9788 0.6916 0.5946 0.2864 0.0598 0.6780 0.8684 0.6690 0.8359 0.5512 0.9383 0.6620 0.6880 0.3769 0.1083 0.5076 0.0348 0.3609 0.8230 0.7353 0.7020 A(:,:,7) = 0.0470 0.8094 0.0710 0.7520 0.3785 0.4880 0.2121 0.8772 0.0304 0.1672 0.1263 0.3466 0.1732 0.4889 0.8601 0.7770 0.6387 0.3391 0.0568 0.9004 0.8212 0.5763 0.2482 0.5658 0.2511 0.0318 0.6962 0.9563 0.7449 0.1300 0.6660 0.5400 0.8097 0.2249 0.5144 0.2276 0.7253 0.0126 0.7711 0.9347 0.0301 0.0471 0.1313 0.0139 0.0638 0.3367 0.5942 0.0487 0.2964 0.6692 0.8939 0.3168 0.2745 0.7622 0.2347 0.2750 0.6393 0.1128 0.8739 0.4363 0.4002 0.7208 0.0522 0.7437 0.5114 0.4863 0.6729 0.8760 0.3440 0.9248 0.5035 0.2160 0.1128 0.9160 0.3008 0.9679 0.6488 0.1230 0.7733 0.9284 0.5729 0.0495 0.9592 0.1483 0.6135 0.9710 0.1806 0.5901 0.2412 0.3952 0.3062 0.4280 0.3196 0.7296 0.5022 0.0301 0.3056 0.4396 0.7465 0.2960 A(:,:,8) = 0.6136 0.5253 0.2487 0.7340 0.7927 0.3995 0.2715 0.6903 0.3062 0.9741 0.8534 0.9878 0.4379 0.4529 0.1258 0.2385 0.8360 0.6302 0.3295 0.2836 0.9368 0.2555 0.6765 0.7030 0.5338 0.1152 0.9745 0.5398 0.1473 0.5081 0.7391 0.0521 0.9112 0.2139 0.9330 0.6164 0.0815 0.3728 0.8019 0.2994 0.2070 0.1690 0.8662 0.1582 0.2254 0.4022 0.3659 0.9006 0.4569 0.3237 0.0807 0.3419 0.6950 0.1373 0.7829 0.6891 0.1816 0.1914 0.6142 0.8557 0.9092 0.4457 0.3081 0.2304 0.4987 0.8236 0.9956 0.6047 0.7442 0.4706 0.9041 0.5464 0.5068 0.0652 0.8134 0.9960 0.3563 0.6603 0.4455 0.1634 0.7072 0.9887 0.9087 0.7032 0.4078 0.8069 0.6153 0.2741 0.0682 0.6035 0.6836 0.0914 0.9394 0.8250 0.1709 0.6604 0.2417 0.0192 0.5751 0.9665 A(:,:,9) = 0.5158 0.2516 0.7846 0.9013 0.5069 0.3937 0.8542 0.3620 0.1405 0.4170 0.3770 0.6619 0.4649 0.5300 0.9921 0.2279 0.5920 0.3843 0.2645 0.8438 0.3097 0.8687 0.3682 0.7099 0.5668 0.6309 0.4641 0.9846 0.0299 0.5951 0.3597 0.9043 0.1267 0.1215 0.1294 0.1991 0.0838 0.7466 0.7338 0.7273 0.9660 0.3081 0.6742 0.5901 0.7935 0.2199 0.7855 0.7491 0.0851 0.2782 0.0817 0.1548 0.7808 0.0912 0.2400 0.2837 0.4815 0.9223 0.0014 0.2686 0.5264 0.8288 0.5716 0.6020 0.6267 0.3631 0.9794 0.1025 0.5252 0.2241 0.0449 0.2169 0.8595 0.1684 0.3610 0.3123 0.3959 0.0985 0.7105 0.8751 0.0524 0.7256 0.3606 0.5216 0.1327 0.0959 0.6434 0.7318 0.4702 0.6141 0.2577 0.6081 0.4472 0.0529 0.9958 0.7438 0.8335 0.7634 0.1391 0.1250 A(:,:,10) = 0.6977 0.6750 0.8480 0.1744 0.9505 0.6994 0.1948 0.9651 0.9569 0.2579 0.8120 0.0617 0.5141 0.6121 0.8725 0.0899 0.9125 0.6022 0.1869 0.0160 0.9979 0.1568 0.7037 0.8717 0.9760 0.2740 0.4639 0.7108 0.9077 0.7617 0.6775 0.4152 0.0739 0.8512 0.8529 0.5306 0.6475 0.3879 0.8473 0.8632 0.3785 0.1787 0.7705 0.8236 0.7054 0.3318 0.2681 0.3777 0.9488 0.3389 0.6459 0.0488 0.0939 0.0040 0.8532 0.2429 0.1779 0.1069 0.6620 0.9160 0.4413 0.0751 0.9380 0.9159 0.1652 0.8263 0.4292 0.9071 0.5916 0.6407 0.1194 0.3759 0.2282 0.7270 0.6225 0.0646 ...

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