Cody

Solution 1824084

Submitted on 23 May 2019 by Anshil Kumar
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.6115 0.2576 0.0913 0.9547 0.0646 0.6728 0.5873 0.9104 0.4613 0.5862 0.9354 0.0427 0.6819 0.7425 0.7135 0.4702 0.3142 0.0147 0.1343 0.7825 0.0566 0.2429 0.1819 0 0.0119 0.6008 0.1823 0.5091 0.9448 0.7546 0.7565 0.3878 0.9509 0.0890 0.4651 0.9093 0.9940 0.0918 0.2695 0.3417 0.9694 0.5644 0.6665 0.4507 0.3364 0.3332 0.5047 0.0244 0.7419 0.4386 0.5196 0.8939 0.0843 0.8678 0.9038 0.0899 0.1481 0.2044 0.2399 0.5360 0.3236 0.5420 0.6568 0.7063 0.8228 0.9123 0.3048 0.2889 0.7886 0.7067 0.4818 0.4521 0.3281 0.1332 0.9490 0.2462 0.6826 0.8607 0.9375 0.1516 0.5183 0.7847 0.3741 0.0265 0.6939 0.1811 0.0294 0.3641 0.2185 0.0042 0.9900 0.7865 0.5369 0.2708 0.3886 0.1952 0.0602 0.1433 0.4050 0.2308 A(:,:,2) = 0.5963 0 0.3197 0.1728 0.2786 0.2128 0.6367 0.6114 0.6487 0.4841 0.1839 0.0073 0.3156 0.8953 0.3581 0.8029 0.4221 0.3574 0.4937 0.9228 0.6545 0.1469 0.5591 0.8171 0.4902 0.4212 0.4418 0.0736 0.7003 0.8900 0.8986 0.1767 0.1036 0.9102 0.6937 0.8708 0.1080 0.5802 0.4455 0.8294 0.5018 0.3770 0.1474 0.1482 0.1333 0.1836 0.2125 0.4105 0.7372 0.1844 0.3551 0.6075 0.7788 0.2560 0.4984 0.9106 0.4958 0.2746 0.2073 0.9128 0.5089 0.2938 0.5102 0.9063 0.5688 0.3635 0.3996 0.2789 0.1515 0.0730 0.9937 0.2761 0.9641 0.3231 0.6965 0.6886 0.0010 0.1688 0.0708 0.4718 0.2135 0.9048 0.0581 0.8092 0.1715 0.1418 0.3958 0.4546 0.6329 0.2970 0.3952 0.2853 0.8654 0.2803 0.5545 0.1656 0.4201 0.4531 0.7707 0.4983 A(:,:,3) = 0.0813 0.3646 0.5589 0.2325 0.1462 0.7740 0.6137 0.2342 0.6017 0.5737 0.0617 0.8253 0.8209 0.0743 0.2380 0.8339 0.5960 0.1096 0.9389 0.8684 0.1116 0.6485 0.6387 0.9916 0.4790 0.2625 0.6749 0.3038 0.6426 0.1302 0.8586 0.3890 0.5779 0.3640 0.1701 0.6820 0.4209 0.9346 0.2781 0.7314 0.0171 0.3388 0.1532 0.2670 0.8651 0 0.7763 0.6904 0.0714 0.2561 0.0113 0.3369 0.8128 0.5988 0.1357 0.7441 0.1987 0.9180 0.0458 0.8902 0.4203 0.1001 0.5482 0.7089 0.4581 0.4816 0.8074 0.0145 0.3027 0.1683 0.2472 0.7765 0.3303 0.9671 0.6565 0.1041 0.0313 0.2179 0.0368 0.4939 0.9356 0.7966 0.4510 0.7629 0.6292 0.1756 0.6201 0.5526 0.0811 0.6608 0.6724 0.7860 0.8776 0.8263 0.4254 0.3878 0.4932 0.5233 0.9824 0.0982 A(:,:,4) = 0.2258 0.2440 0.3558 0.1743 0.2744 0.0418 0.7514 0.3682 0.1250 0.5275 0.6896 0.3764 0.2227 0.4650 0.2757 0.5214 0.1345 0.6784 0.5105 0.0833 0.7661 0.7118 0.3798 0.1450 0.9993 0.9065 0.0008 0.5956 0.8903 0.4060 0.7635 0.6660 0.9579 0.1831 0.9466 0.6479 0.3203 0.6233 0.0244 0.8231 0.5676 0.2029 0.2029 0.0121 0.6046 0.5866 0.2511 0.6444 0.0168 0.0522 0.1989 0.1125 0.3871 0.6433 0.9927 0.6543 0.8096 0.5355 0.8070 0.1947 0.6711 0.9304 0.8636 0.7108 0.9351 0.4142 0.7707 0.0458 0.5805 0.0106 0.0367 0.7258 0.7391 0.1086 0.5404 0.7517 0.5115 0.0374 0.1415 0.1679 0.4113 0.6075 0.9184 0.5024 0.9289 0.3881 0.0673 0.6598 0.0921 0.4010 0.9363 0.8100 0.0741 0.5058 0.3827 0.3332 0.6737 0.9210 0.8310 0.8632 A(:,:,5) = 0.9504 0.2741 0.2467 0.0762 0.9956 0.5940 0.9636 0.0301 0.2596 0.9970 0.9590 0.7947 0.3831 0.7166 0.4627 0.6709 0.5742 0.7570 0.8381 0.8120 0.6969 0.8065 0.4375 0.5971 0.9469 0.6698 0.6719 0.5289 0.5841 0.2107 0.5244 0.1065 0.2377 0.3795 0.4100 0.5477 0.4580 0.3022 0.3291 0.4175 0.2753 0.5326 0.7072 0.7447 0.8290 0.6245 0.7478 0.4502 0.2989 0.6935 0.3589 0.0412 0.3498 0.6999 0.7025 0.3239 0.4952 0.0917 0.9579 0.6832 0.4531 0.0526 0.2789 0.7312 0.9477 0.0738 0.5563 0.2603 0.7524 0.1604 0.7113 0.6456 0.6422 0.6438 0.7360 0.2998 0.1893 0.6752 0.5841 0.2413 0.2994 0.7214 0.1636 0.4041 0.0360 0.2278 0.2708 0.8087 0.2782 0.1923 0.1435 0.3432 0.6879 0.3422 0.7706 0.7335 0.6983 0.9965 0.9261 0.3949 A(:,:,6) = 0.8086 0.3144 0.5389 0.8960 0.6284 0.9426 0.7392 0.7881 0.9283 0.4704 0.3056 0.2326 0.1665 0.9953 0.6779 0.6518 0.4145 0.7767 0.2226 0.0973 0.0588 0.1515 0.1038 0.8468 0.8583 0.3832 0.6072 0.3943 0.8706 0.3535 0.0212 0.0386 0.0908 0.6302 0.2284 0.2560 0.4716 0.5523 0.4376 0.4511 0.2883 0.9203 0.1662 0.5927 0.7247 0.1705 0.3618 0.1813 0.8053 0.7139 0.6988 0.4683 0.4339 0.9595 0.2681 0.0698 0.3886 0.2238 0.5531 0.7995 0.0988 0.8631 0.4543 0.4239 0.8216 0.0931 0.0804 0.4892 0.6264 0.0188 0.7808 0.0580 0.3240 0.3011 0.2501 0.7263 0.0648 0.9627 0.6134 0.7037 0.0885 0.5319 0.0238 0.9027 0.3928 0.0833 0.4028 0.4943 0.3789 0.5369 0.6677 0.9874 0.6646 0.8607 0.3884 0.3470 0.7864 0.2528 0.6627 0.4146 A(:,:,7) = 0.2625 0.4867 0.3571 0.8099 0.6877 0.4833 0.6144 0.0538 0.1729 0.1523 0.8711 0.9248 0.4402 0.1405 0.3587 0.2914 0.2412 0.0821 0.2267 0.6642 0.3589 0.4519 0.7359 0.5922 0.3630 0.9372 0.9299 0.7131 0.2547 0.5154 0.8840 0.8741 0.9403 0.4630 0.4548 0.2538 0.2916 0.5144 0.1910 0.3772 0.3029 0.0325 0.4263 0.4961 0.0181 0.5378 0.8546 0.7465 0.7484 0.3634 0.8362 0.6165 0.0235 0.5729 0.7803 0.2359 0.7424 0.2725 0.3628 0.2695 0.9490 0.1228 0.4386 0.0390 0.0666 0.8832 0.8267 0.3764 0.8079 0.9985 0.4540 0.4660 0.9874 0.5506 0.3108 0.1754 0.9078 0.3181 0.6530 0.9584 0.0279 0.8720 0.6689 0.5440 0.2356 0.8536 0.3293 0.5542 0.5443 0.5328 0.0285 0.2318 0.5345 0.3557 0.0558 0.1223 0.5156 0.3443 0.0219 0.4961 A(:,:,8) = 0.3965 0.9438 0.6741 0.7509 0.7812 0.7134 0.2528 0.8595 0.9042 0.9716 0.2769 0.1185 0.2042 0.8171 0.8711 0.3763 0.0411 0.1073 0.7288 0.5377 0.4436 0.1250 0.3420 0.9694 0.3660 0.8194 0.6235 0.1098 0.3350 0.3819 0.0449 0.6739 0.9864 0.8112 0.2222 0.1535 0.6365 0.3491 0.5876 0.8920 0.1381 0.5364 0.8100 0.6340 0.7038 0.3879 0.1229 0.6219 0.2826 0.5121 0.5874 0.6468 0.4237 0.7956 0.4073 0.4657 0.0467 0.0804 0.8169 0.9146 0.5950 0.0546 0.7260 0.6815 0.9826 0.6323 0.8222 0.0746 0.6359 0.7090 0.9179 0.5296 0.5286 0.3060 0.9245 0.8691 0.3735 0.6090 0.6929 0.1869 0.3672 0.3061 0.6186 0.6655 0.1658 0.3266 0.5531 0.4370 0.1306 0.1061 0.9145 0.1426 0.2339 0.4120 0.1250 0.8923 0.5974 0.1304 0.1057 0.5512 A(:,:,9) = 0.2623 0.9808 0.8790 0.1084 0.6861 0.5086 0.7532 0.8537 0.0332 0.6652 0.0280 0.7905 0.4863 0.2309 0.5158 0.0507 0.3703 0.8681 0.2155 0.5736 0.5168 0.4072 0.8918 0.7610 0.9211 0.5892 0.9775 0.4485 0.7140 0.3052 0.2404 0.4295 0.0530 0.2548 0.0478 0.6765 0.3432 0.0778 0.8827 0.9007 0.5929 0.0246 0.4995 0.6162 0.9691 0.0125 0.2040 0.0961 0.3144 0.8856 0.0031 0.8435 0.7938 0.2036 0.3590 0.2001 0.4072 0.2434 0.2205 0.0693 0.6560 0.2888 0.6980 0.9534 0.5128 0.6451 0.5481 0.2765 0.2559 0.1376 0.1171 0.2707 0.5898 0.1157 0.1767 0.4629 0.8728 0.7988 0.0712 0.6466 0.6055 0.1814 0.4050 0.0400 0.4918 0.3567 0.2131 0.4152 0.3562 0.4205 0.6252 0.7546 0.7427 0.8765 0.3427 0.7245 0.5359 0.6152 0.2949 0.4184 A(:,:,10) = 0.9429 0.8094 0.0441 0.8298 0.9596 0.7173 0.9806 0.3975 0.0511 0.5019 0.6250 0.4934 0.3249 0.8632 0.9960 0.9210 0.5905 0.6980 0.6158 0.6365 0.6683 0.5386 0.3236 0.6995 0.0199 0.7856 0.6459 0.5322 0.2842 0.8713 0.2724 0.7397 0.2366 0.4682 0.3263 0.1719 0.9926 0.7315 0.5105 0.5948 0.9326 0.5531 0.7977 0.4883 0.1238 0.2038 0.6664 0.4294 0.2367 0.7680 0.7934 0.4428 0.7466 0.4390 0.7118 0.8914 0.8627 0.5735 0.2461 0.4391 0.3226 0.0270 0.9217 0.5588 0.1420 0.6152 0.4288 0.8294 0.0743 0.5855 0.4167 0.1526 0.5232 0.1373 0.3093 0.8793 ...

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