Cody

Solution 2044041

Submitted on 3 Dec 2019 by Michael Koscelník
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.1875 0.4976 0.8728 0.1116 0.4118 0.5649 0.2542 0.0872 0.0833 0.2758 0.1238 0.3025 0.6149 0.0109 0.8184 0.0603 0.5125 0.6443 0.8029 0.1262 0.1798 0.2241 0.6961 0 0.4063 0.5681 0.4333 0.6641 0.7230 0.2915 0.7764 0.3758 0.2760 0.6134 0.5968 0.1411 0.8603 0.1079 0.9204 0.5378 0.1173 0.6000 0.6343 0.2424 0.5599 0.6789 0.9159 0.5018 0.4159 0.2596 0.8934 0.0067 0.0267 0.2001 0.9504 0.9198 0.2944 0.9687 0.3756 0.4741 0.6568 0.4572 0.0627 0.5185 0.9313 0.9462 0.9033 0.0388 0.0598 0.0256 0.6089 0.1545 0.8394 0.9621 0.5009 0.4250 0.3299 0.1331 0.4081 0.5716 0.2195 0.6200 0.1923 0.8324 0.7855 0.9233 0.2621 0.7142 0.6344 0.7361 0.0155 0.3898 0.7004 0.0345 0.5174 0.4892 0.5546 0.0838 0.4825 0.8826 A(:,:,2) = 0.9980 0 0.7014 0.8008 0.7266 0.6519 0.7886 0.0359 0.2004 0.4392 0.3544 0.4597 0.5136 0.2863 0.0684 0.4736 0.3070 0.6403 0.9827 0.5080 0.8365 0.2933 0.1822 0.8058 0.4693 0.8919 0.0295 0.4549 0.9911 0.5611 0.6629 0.9110 0.9341 0.7453 0.6407 0.0705 0.0421 0.1278 0.8968 0.6806 0.1134 0.4395 0.0853 0.2316 0.6409 0.1623 0.1553 0.3388 0.0488 0.9833 0.1098 0.4129 0.1403 0.7476 0.0331 0.7283 0.0239 0.5816 0.7301 0.3290 0.1054 0.8629 0.3142 0.9933 0.7771 0.3300 0.0199 0.6460 0.1707 0.3972 0.4730 0.5062 0.0839 0.5242 0.0748 0.8815 0.5656 0.2011 0.4048 0.7399 0.0746 0.8799 0.7599 0.0226 0.3507 0.0590 0.0439 0.5524 0.0571 0.3294 0.3574 0.4771 0.5865 0.3162 0.1819 0.5688 0.9746 0.3655 0.5086 0.8373 A(:,:,3) = 0.1066 0.8916 0.9386 0.4421 0.2209 0.1622 0.4045 0.6385 0.5147 0.6439 0.2131 0.8173 0.2254 0.0363 0.2333 0.0916 0.8532 0.5196 0.5504 0.9301 0.4475 0.3159 0.7079 0.6509 0.0312 0.0993 0.2824 0.4939 0.2031 0.0783 0.3343 0.1992 0.4008 0.9576 0.1283 0.5258 0.8983 0.5718 0.7491 0.2441 0.2689 0.5601 0.0827 0.8774 0.7448 0 0.6066 0.9547 0.9246 0.5341 0.7556 0.7747 0.9073 0.0951 0.0491 0.9862 0.6297 0.0844 0.4344 0.6785 0.3479 0.0713 0.3639 0.0166 0.5288 0.4995 0.3248 0.0461 0.0161 0.9327 0.6770 0.4113 0.5752 0.3966 0.4301 0.9158 0.5225 0.4008 0.2176 0.0661 0.0186 0.8367 0.9542 0.2492 0.1820 0.9102 0.7124 0.8653 0.5374 0.5728 0.8288 0.0390 0.2234 0.6516 0.0304 0.3996 0.7571 0.4241 0.3174 0.2132 A(:,:,4) = 0.5633 0.0850 0.9911 0.4085 0.9934 0.3066 0.5238 0.9552 0.9572 0.3961 0.2393 0.5846 0.8071 0.2933 0.8915 0.6306 0.7884 0.8675 0.5943 0.4040 0.9731 0.5622 0.2505 0.8334 0.3135 0.9741 0.8628 0.3198 0.0138 0.5052 0.6291 0.0400 0.4246 0.5022 0.2400 0.4413 0.9551 0.7606 0.2565 0.0677 0.9292 0.1267 0.8297 0.1193 0.6532 0.3445 0.2069 0.8292 0.6949 0.2067 0.9835 0.1119 0.1029 0.8227 0.2861 0.2686 0.8933 0.4307 0.1804 0.4421 0.7726 0.8194 0.0549 0.1317 0.4938 0.8022 0.0233 0.7388 0.2487 0.3810 0.2323 0.1405 0.8154 0.0141 0.4041 0.1354 0.9853 0.6656 0.8304 0.8204 0.4185 0.6045 0.1761 0.9125 0.0543 0.8432 0.8756 0.1453 0.0663 0.9430 0.7442 0.4126 0.7346 0.9072 0.7495 0.7078 0.7546 0.9382 0.4048 0.5561 A(:,:,5) = 0.0288 0.8828 0.8966 0.7422 0.7268 0.3547 0.5828 0.1724 0.3251 0.3256 0.6196 0.4418 0.6592 0.4896 0.8919 0.9755 0.3667 0.6492 0.5736 0.9102 0.4906 0.3700 0.5962 0.0418 0.1574 0.3915 0.0006 0.4780 0.4309 0.4113 0.0221 0.0595 0.0162 0.5026 0.6590 0.1016 0.9376 0.1450 0.3583 0.2082 0.3864 0.7608 0.3158 0.4577 0.1518 0.9897 0.1707 0.2833 0.2938 0.1459 0.5776 0.8485 0.8263 0.8902 0.0653 0.5016 0.4870 0.1973 0.1097 0.1439 0.5388 0.1591 0.9907 0.4379 0.8227 0.4670 0.2092 0.5230 0.1251 0.5874 0.2644 0.8790 0.9275 0.3062 0.7107 0.9962 0.6884 0.6699 0.4261 0.6932 0.7941 0.9421 0.7054 0.1662 0.4448 0.4365 0.7529 0.3863 0.9263 0.9822 0.8777 0.0164 0.5484 0.2715 0.2484 0.2150 0.2408 0.6872 0.7729 0.2740 A(:,:,6) = 0.8776 0.6410 0.9638 0.3142 0.0004 0.4526 0.8265 0.1225 0.3904 0.0387 0.4180 0.5715 0.5417 0.3253 0.3445 0.1922 0.4753 0.1469 0.9093 0.5641 0.2169 0.2119 0.7444 0.2951 0.1219 0.0622 0.1507 0.5895 0.0292 0.8830 0.8451 0.9053 0.5036 0.7908 0.0362 0.2184 0.3604 0.3393 0.2416 0.9605 0.8347 0.8911 0.8635 0.2273 0.1069 0.3615 0.1073 0.2608 0.5612 0.9695 0.3900 0.4087 0.4092 0.9757 0.5046 0.6998 0.8383 0.1228 0.3431 0.9663 0.5183 0.2393 0.9586 0.2623 0.4928 0.9096 0.3114 0.7841 0.9333 0.2803 0.5777 0.0343 0.3961 0.7294 0.9050 0.9636 0.9604 0.8782 0.7807 0.3595 0.5344 0.5356 0.1287 0.1837 0.5235 0.7412 0.6079 0.3030 0.6421 0.7488 0.0806 0.8704 0.8485 0.0182 0.1551 0.0600 0.8207 0.5800 0.1113 0.0956 A(:,:,7) = 0.5361 0.4061 0.3220 0.7097 0.1646 0.4015 0.2167 0.3316 0.9174 0.2163 0.7035 0.8892 0.0857 0.8474 0.7549 0.6147 0.4872 0.2979 0.1189 0.6191 0.8237 0.5617 0.4043 0.2364 0.0815 0.5893 0.0350 0.8118 0.4614 0.4356 0.9502 0.2790 0.0780 0.6329 0.3313 0.6160 0.2024 0.9729 0.4387 0.5579 0.2440 0.9601 0.4814 0.7891 0.0689 0.5128 0.8842 0.8366 0.3240 0.7164 0.1238 0.2560 0.1782 0.5191 0.1099 0.6135 0.7996 0.6341 0.1222 0.3144 0.2261 0.2038 0.9916 0.4488 0.3966 0.6726 0.3906 0.8034 0.6214 0.7439 0.7137 0.6293 0.6863 0.1219 0.2380 0.0714 0.5169 0.0402 0.0393 0.5489 0.7774 0.6068 0.3333 0.7798 0.7704 0.7698 0.8957 0.6037 0.8691 0.4533 0.1266 0.1471 0.6453 0.9056 0.4150 0.8715 0.7730 0.6191 0.4996 0.7034 A(:,:,8) = 0.7068 0.3728 0.4197 0.0348 0.4826 0.6929 0.6869 0.2937 0.7954 0.0459 0.0453 0.8049 0.4055 0.2402 0.3830 0.5619 0.6498 0.5946 0.5677 0.7774 0.3351 0.2802 0.5315 0.5062 0.7219 0.7486 0.0848 0.4645 0.8922 0.2096 0.4877 0.9374 0.5175 0.0152 0.9071 0.6206 0.2994 0.3150 0.2371 0.1876 0.4868 0.5436 0.3206 0.5218 0.6986 0.7928 0.7953 0.8186 0.0561 0.2720 0.4412 0.0343 0.0477 0.3477 0.5013 0.1744 0.4833 0.2524 0.5439 0.8412 0.0821 0.6743 0.6643 0.9576 0.2414 0.6380 0.5633 0.6080 0.7445 0.6900 0.5641 0.8503 0.8834 0.6294 0.0033 0.0753 0.3174 0.4207 0.7551 0.0084 0.2333 0.3070 0.7212 0.4394 0.1930 0.5366 0.2182 0.8386 0.2446 0.1284 0.3754 0.6962 0.9350 0.5420 0.0835 0.5094 0.7805 0.4327 0.8295 0.8270 A(:,:,9) = 0.5074 0.6420 0.6012 0.5872 0.6341 0.8295 0.5834 0.6299 0.0226 0.3423 0.7683 0.8353 0.4182 0.7540 0.7008 0.5638 0.9566 0.5278 0.4742 0.5827 0.9384 0.6144 0.0312 0.1339 0.8142 0.9281 0.7788 0.9466 0.6365 0.7023 0.2163 0.4326 0.2333 0.5158 0.2428 0.2218 0.7443 0.4515 0.8554 0.2066 0.9618 0.0087 0.8755 0.3620 0.0452 0.3832 0.4812 0.1386 0.9020 0.5784 0.6801 0.3077 0.5146 0.4184 0.7838 0.2200 0.5698 0.5997 0.1065 0.9651 0.1418 0.7595 0.6806 0.4229 0.4327 0.7968 0.5468 0.6101 0.0814 0.6311 0.3943 0.4955 0.0051 0.6774 0.4751 0.6607 0.2648 0.8062 0.7492 0.3468 0.1974 0.2740 0.1282 0.0206 0.6015 0.2558 0.2721 0.3347 0.9672 0.7158 0.7475 0.3477 0.1237 0.7791 0.5453 0.5223 0.9575 0.8612 0.9765 0.3053 A(:,:,10) = 0.3381 0.5247 0.8286 0.6079 0.1395 0.7807 0.2672 0.2029 0.7552 0.7131 0.6324 0.1647 0.8080 0.6772 0.7320 0.0322 0.6225 0.5564 0.9508 0.6042 0.6566 0.0333 0.2411 0.6103 0.9600 0.7798 0.9697 0.5725 0.3848 0.4375 0.8062 0.3639 0.4397 0.7140 0.5924 0.0713 0.1604 0.0268 0.9250 0.3618 0.3488 0.4056 0.1505 0.9396 0.6548 0.7349 0.2616 0.3724 0.2555 0.7396 0.8932 0.3322 0.0617 0.2368 0.4006 0.8842 0.7931 0.0983 0.5868 0.8679 0.1203 0.3505 0.7536 0.0097 0.1780 0.0550 0.9782 0.2767 0.3900 0.4071 0.9103 0.6195 0.5829 0.0488 0.0840 0.8737 ...

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