Cody

Solution 1812538

Submitted on 10 May 2019 by Be Matlabi
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')

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

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

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

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

B(:,:,1) = 0.1923 0.3280 0.5137 0.4306 0.2388 0.5646 0.6986 0.1146 0.6856 0.8725 0.2536 0.2074 0.2557 0.8403 0.2002 0.1734 0.9118 0.3502 0.0970 0.3988 0.7296 0.4961 0.3862 0 0.4811 0.1978 0.3132 0.5682 0.0731 0.2317 0.0969 0.5522 0.2353 0.1867 0.6698 0.7603 0.6115 0.6955 0.5591 0.3195 0.2361 0.5347 0.3670 0.0491 0.7908 0.1462 0.5936 0.2704 0.7305 0.4441 0.3995 0.9945 0.0218 0.9871 0.9815 0.2377 0.1554 0.4448 0.0423 0.9390 0.1415 0.5021 0.3724 0.8060 0.9391 0.7260 0.9641 0.2032 0.8175 0.6486 0.0921 0.7708 0.7299 0.1106 0.1986 0.2640 0.5957 0.9962 0.6226 0.7225 0.6420 0.6263 0.7600 0.3678 0.9975 0.6997 0.5404 0.0057 0.3723 0.6543 0.1868 0.7291 0.0314 0.9313 0.2649 0.3024 0.9482 0.6832 0.2768 0.4399 B(:,:,2) = 0.1932 0 0.3541 0.0539 0.4444 0.7122 0.5714 0.8621 0.6916 0.9371 0.6444 0.9561 0.3143 0.7933 0.4418 0.9609 0.8625 0.9716 0.4629 0.3428 0.3638 0.8090 0.9920 0.9737 0.8483 0.4936 0.3755 0.9987 0.3123 0.7539 0.9948 0.8450 0.7272 0.2008 0.4083 0.1735 0.1528 0.8883 0.5468 0.9698 0.0231 0.2500 0.4790 0.7115 0.9871 0.8905 0.0178 0.4482 0.0737 0.9921 0.2770 0.9377 0.3449 0.4106 0.1350 0.6398 0.5074 0.9879 0.6929 0.4758 0.9698 0.3614 0.7935 0.5196 0.2960 0.5012 0.9647 0.4248 0.8083 0.3233 0.5500 0.8869 0.2710 0.3303 0.4657 0.7111 0.3632 0.9009 0.2926 0.6850 0.1688 0.3342 0.0736 0.7791 0.4095 0.5808 0.6757 0.3850 0.2871 0.5741 0.8120 0.5860 0.0063 0.6988 0.4934 0.7090 0.3153 0.6685 0.7727 0.3448 B(:,:,3) = 0.1848 0.5901 0.6913 0.2451 0.3290 0.3233 0.9384 0.2669 0.0181 0.3725 0.3095 0.5251 0.9544 0.6159 0.7778 0.6802 0.1381 0.5574 0.2081 0.5640 0.2826 0.4045 0.3743 0.2468 0.8015 0.2813 0.6487 0.0862 0.4771 0.3313 0.7715 0.4209 0.7347 0.2325 0.7661 0.0802 0.0362 0.9971 0.6931 0.1956 0.2212 0.2604 0.9670 0.4208 0.8563 0 0.4873 0.7532 0.3703 0.5795 0.8165 0.6109 0.4061 0.7444 0.3347 0.1878 0.9480 0.2412 0.1257 0.6691 0.1917 0.0799 0.1549 0.6221 0.2927 0.7911 0.2200 0.7139 0.2990 0.6134 0.6670 0.4868 0.1554 0.9882 0.2486 0.3113 0.1027 0.6423 0.1550 0.5349 0.6596 0.5541 0.4903 0.3003 0.0579 0.3815 0.0913 0.2166 0.3336 0.5154 0.5947 0.0338 0.1527 0.8839 0.3785 0.4240 0.9028 0.2237 0.0082 0.8058 B(:,:,4) = 0.9453 0.3851 0.0069 0.7160 0.7362 0.0433 0.8989 0.2876 0.8350 0.0446 0.1562 0.9292 0.5878 0.2489 0.8312 0.6790 0.1208 0.3109 0.0294 0.9537 0.7827 0.8761 0.6429 0.6799 0.9053 0.8731 0.4405 0.9115 0.8902 0.0620 0.7960 0.5888 0.4603 0.1167 0.3137 0.8407 0.5628 0.7186 0.2094 0.4942 0.5061 0.8605 0.4773 0.3881 0.8021 0.8541 0.4400 0.1799 0.6748 0.2524 0.2627 0.0392 0.9763 0.2366 0.6970 0.2672 0.9039 0.2084 0.2090 0.1374 0.3958 0.5563 0.8769 0.8311 0.6472 0.3663 0.8020 0.8563 0.1281 0.5295 0.2362 0.1419 0.1327 0.7741 0.2502 0.8728 0.9943 0.5632 0.6348 0.9856 0.8816 0.4189 0.8479 0.7593 0.2073 0.7468 0.3149 0.7534 0.6471 0.7881 0.9530 0.2998 0.3765 0.6263 0.1401 0.4846 0.1961 0.3161 0.4689 0.0937 B(:,:,5) = 0.6719 0.8689 0.6576 0.7857 0.2599 0.3740 0.9712 0.3558 0.2823 0.3607 0.0572 0.5073 0.0442 0.5616 0.2743 0.6237 0.3026 0.1972 0.0268 0.5217 0.1006 0.1443 0.3151 0.1011 0.0579 0.7741 0.2850 0.4509 0.9167 0.8308 0.3133 0.8728 0.5290 0.2117 0.7295 0.4706 0.0301 0.8053 0.8560 0.3775 0.9732 0.7291 0.0531 0.5939 0.2079 0.1371 0.5590 0.6223 0.0827 0.4262 0.4900 0.5395 0.2179 0.9635 0.6833 0.1690 0.1202 0.1726 0.4304 0.0374 0.5269 0.6915 0.0421 0.7023 0.2105 0.4963 0.9928 0.2282 0.1530 0.6934 0.2098 0.2223 0.1603 0.1868 0.1342 0.6586 0.0647 0.4949 0.9452 0.0469 0.9582 0.2319 0.5475 0.0534 0.6512 0.8141 0.3704 0.1397 0.2418 0.7961 0.9258 0.7356 0.4152 0.2626 0.7343 0.2755 0.0152 0.6966 0.9029 0.5991 B(:,:,6) = 0.8164 0.5269 0.1514 0.6946 0.6182 0.6884 0.9479 0.3238 0.1094 0.5693 0.2008 0.4785 0.6859 0.1624 0.6179 0.2464 0.0021 0.5100 0.4129 0.1104 0.5598 0.4132 0.9304 0.5732 0.8830 0.9346 0.5301 0.0424 0.7562 0.9810 0.9358 0.9846 0.5842 0.3937 0.3548 0.7942 0.9151 0.9354 0.4473 0.4123 0.9755 0.1192 0.9279 0.8005 0.5504 0.6985 0.5557 0.9585 0.8522 0.8234 0.7385 0.1530 0.0153 0.1454 0.8511 0.0386 0.3386 0.9737 0.7634 0.3612 0.2734 0.3935 0.1886 0.2640 0.5416 0.5193 0.3479 0.5286 0.8264 0.0780 0.8588 0.5363 0.1365 0.8564 0.4975 0.0110 0.0477 0.1982 0.2768 0.4412 0.5823 0.6727 0.2616 0.3700 0.5427 0.5065 0.5840 0.6835 0.9236 0.7666 0.4946 0.6219 0.4983 0.0355 0.8255 0.5267 0.7142 0.7721 0.3855 0.4782 B(:,:,7) = 0.1709 0.2164 0.3155 0.0415 0.4632 0.2418 0.6086 0.6322 0.6510 0.7762 0.7569 0.7798 0.1062 0.0347 0.0084 0.3767 0.8891 0.3848 0.3371 0.4853 0.0927 0.6404 0.8359 0.0051 0.2576 0.9448 0.3664 0.3182 0.2493 0.4160 0.1285 0.3528 0.2778 0.4197 0.6806 0.7038 0.6327 0.3361 0.6393 0.6174 0.7564 0.3446 0.0873 0.9110 0.4137 0.0373 0.8796 0.7647 0.7685 0.1570 0.2635 0.7939 0.0802 0.4426 0.0949 0.0135 0.1397 0.2809 0.6209 0.5674 0.1580 0.5761 0.0591 0.8910 0.5266 0.2717 0.7072 0.6886 0.2288 0.3058 0.0684 0.1411 0.5828 0.8193 0.1975 0.2447 0.3215 0.3264 0.7232 0.8051 0.5771 0.8855 0.8771 0.5885 0.1105 0.7958 0.4455 0.6470 0.9889 0.9121 0.3995 0.6496 0.1298 0.8682 0.7225 0.7203 0.3227 0.4220 0.0082 0.5758 B(:,:,8) = 0.8237 0.5408 0.0095 0.1517 0.7315 0.2808 0.3549 0.3600 0.4609 0.4977 0.2185 0.0807 0.8412 0.5583 0.8197 0.6052 0.2543 0.1388 0.9284 0.3011 0.0417 0.8580 0.1967 0.5514 0.9241 0.0109 0.1580 0.9533 0.3331 0.7134 0.3471 0.7673 0.1676 0.8631 0.1522 0.0409 0.9165 0.9619 0.6087 0.2710 0.7075 0.5646 0.5933 0.8033 0.2930 0.2615 0.6492 0.0132 0.0492 0.3717 0.9055 0.5565 0.3062 0.1588 0.6488 0.3036 0.3559 0.6333 0.4953 0.9627 0.1872 0.4921 0.6666 0.9993 0.3019 0.7368 0.1095 0.2851 0.2013 0.2952 0.6176 0.6687 0.0953 0.6601 0.6902 0.4804 0.7085 0.0473 0.1765 0.1704 0.1597 0.0115 0.6881 0.0488 0.1248 0.3737 0.6458 0.0869 0.6521 0.1803 0.0802 0.0732 0.3603 0.1062 0.9486 0.5348 0.9415 0.1748 0.5626 0.3506 B(:,:,9) = 0.6453 0.7082 0.8409 0.6719 0.9834 0.1025 0.4070 0.4347 0.7174 0.8093 0.4597 0.9899 0.6821 0.8707 0.9231 0.1251 0.3316 0.1775 0.4170 0.6554 0.2299 0.0119 0.0847 0.5107 0.5163 0.3512 0.1426 0.8858 0.2908 0.6656 0.7535 0.1762 0.9158 0.0508 0.3282 0.6451 0.0110 0.5401 0.6246 0.0856 0.6461 0.0315 0.8575 0.5593 0.1443 0.7294 0.2907 0.4438 0.5980 0.7170 0.0123 0.1079 0.9429 0.0084 0.0448 0.3649 0.9979 0.3250 0.0306 0.3050 0.9194 0.5994 0.7782 0.4652 0.2117 0.0463 0.8325 0.9100 0.0681 0.2982 0.4825 0.4761 0.9824 0.1131 0.3449 0.1540 0.8153 0.0584 0.2779 0.8477 0.5945 0.3740 0.3041 0.0836 0.5478 0.5039 0.2480 0.4313 0.4072 0.6194 0.0986 0.5096 0.0176 0.6974 0.4675 0.1059 0.3983 0.3927 0.2332 0.7027 B(:,:,10) = 0.9893 0.2457 0.0927 0.4588 0.7142 0.3114 0.3385 0.1022 0.4646 0.7050 0.1866 0.8498 0.0508 0.7689 0.6406 0.5389 0.5392 0.6906 0.2455 0.3807 0.1292 0.5585 0.7617 0.0296 0.1644 0.1101 0.0012 0.6291 0.5953 0.0741 0.7425 0.9626 0.1978 0.8283 0.3887 0.0375 0.4412 0.6769 0.5780 0.5145 0.1825 0.2587 0.3197 0.9148 0.7854 0.7624 0.0614 0.4735 0.2478 0.3691 0.6099 0.6173 0.7327 0.5290 0.0807 0.2620 0.1287 0.5615 0.5934 0.4532 0.6514 0.2866 0.9931 0.4434 0.2190 0.6379 0.7330 0.3594 0.8512 0.9379 0.3859 0.9879 0.4954 0.5303 0.7180 0.6388 ...

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

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

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

B = 13.3000