Cody

Solution 1963973

Submitted on 7 Oct 2019 by Gunther S
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

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

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 = []

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

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.2803 0.8919 0.6874 0.3577 0.2749 0.3782 0.3202 0.6518 0.8500 0.7256 0.3100 0.5918 0.7608 0.7225 0.1958 0.9747 0.8016 0.9950 0.8327 0.5758 0.7699 0.5304 0.5095 0 0.2322 0.6036 0.8190 0.3678 0.5711 0.6197 0.9761 0.3677 0.1750 0.1485 0.5448 0.5349 0.4548 0.3854 0.9795 0.7813 0.5856 0.5582 0.7829 0.5422 0.7298 0.8603 0.7983 0.0338 0.6627 0.3993 0.2720 0.7140 0.4756 0.9328 0.8394 0.1823 0.1880 0.3913 0.4007 0.3320 0.8682 0.6043 0.6257 0.6933 0.3175 0.5293 0.0350 0.5003 0.7760 0.5970 0.6861 0.7396 0.7487 0.5905 0.3754 0.3654 0.4269 0.2579 0.0686 0.2425 0.1091 0.2416 0.6586 0.4788 0.7440 0.7998 0.1790 0.1358 0.0062 0.3427 0.7812 0.4957 0.1392 0.9013 0.8785 0.1104 0.5950 0.9975 0.6753 0.1778 A(:,:,2) = 0.6573 0 0.8576 0.5052 0.0737 0.7280 0.9057 0.9840 0.0516 0.6060 0.2663 0.2323 0.3523 0.4247 0.3215 0.3772 0.1803 0.2438 0.6559 0.6892 0.6282 0.3500 0.4186 0.2173 0.1669 0.9443 0.8577 0.4611 0.5419 0.0255 0.4629 0.8991 0.4927 0.1291 0.6536 0.7968 0.2948 0.1964 0.4708 0.6090 0.7758 0.2512 0.3911 0.5912 0.4589 0.9139 0.5365 0.0554 0.3510 0.8554 0.2684 0.4371 0.1577 0.0163 0.9683 0.2931 0.4670 0.5036 0.9874 0.5974 0.2565 0.3206 0.9082 0.6941 0.2362 0.2502 0.7945 0.2848 0.4162 0.2747 0.4839 0.2117 0.1018 0.8068 0.9577 0.7679 0.8909 0.2125 0.2737 0.2127 0.3822 0.5447 0.0620 0.2588 0.0976 0.2731 0.3912 0.3237 0.0411 0.3462 0.1696 0.9283 0.4985 0.4618 0.4556 0.6267 0.2940 0.5230 0.6026 0.3074 A(:,:,3) = 0.7331 0.5194 0.9734 0.6718 0.2187 0.4294 0.3692 0.1015 0.6078 0.9613 0.2805 0.3417 0.9062 0.2244 0.7826 0.7287 0.5891 0.1103 0.8496 0.7440 0.2083 0.7522 0.6652 0.0075 0.4970 0.1264 0.7399 0.8296 0.8224 0.0521 0.9789 0.9202 0.5256 0.4132 0.6253 0.3006 0.8435 0.7631 0.5278 0.7492 0.1154 0.1706 0.3982 0.5951 0.0730 0 0.7922 0.4696 0.3799 0.6923 0.7281 0.7494 0.1894 0.8182 0.0588 0.9873 0.9459 0.6748 0.6463 0.1087 0.6168 0.8701 0.0224 0.0239 0.2854 0.9270 0.3325 0.3237 0.9300 0.9383 0.4377 0.7163 0.3460 0.0281 0.0270 0.1119 0.6241 0.9350 0.3136 0.6372 0.4698 0.8606 0.0383 0.8121 0.3778 0.7238 0.2513 0.1304 0.9665 0.3478 0.7236 0.2407 0.1480 0.0099 0.6544 0.8965 0.2156 0.6582 0.0959 0.9850 A(:,:,4) = 0.5512 0.6982 0.9117 0.8507 0.1853 0.8096 0.6263 0.2215 0.3480 0.2986 0.4424 0.8705 0.8027 0.4715 0.5635 0.2392 0.6869 0.4542 0.5416 0.0700 0.2186 0.0860 0.6281 0.7207 0.8360 0.5279 0.8141 0.8846 0.5548 0.1465 0.9065 0.9973 0.3069 0.2322 0.5496 0.4567 0.2487 0.3734 0.9685 0.5016 0.4449 0.7133 0.8781 0.6032 0.3464 0.8703 0.1478 0.0321 0.5560 0.8953 0.8828 0.4313 0.4599 0.2492 0.3443 0.1270 0.2607 0.7618 0.3361 0.0295 0.7416 0.5033 0.9534 0.7832 0.7772 0.0039 0.9200 0.1369 0.6784 0.4789 0.1202 0.3602 0.7401 0.3181 0.2613 0.0340 0.8139 0.6338 0.2200 0.5320 0.6257 0.3276 0.7320 0.2368 0.7328 0.0685 0.2980 0.6998 0.6222 0.4060 0.7898 0.5360 0.2381 0.1225 0.0183 0.9274 0.8249 0.2860 0.1132 0.5311 A(:,:,5) = 0.4679 0.0143 0.7492 0.0691 0.1948 0.8643 0.8316 0.5951 0.5324 0.0405 0.5391 0.0973 0.3090 0.3684 0.3409 0.9665 0.0572 0.8910 0.8477 0.6955 0.3935 0.5682 0.7619 0.4152 0.9059 0.0310 0.0637 0.8486 0.2440 0.1550 0.1562 0.0791 0.5548 0.3313 0.3971 0.3753 0.2880 0.2538 0.8894 0.1092 0.5467 0.2970 0.2136 0.7221 0.1580 0.9456 0.3042 0.8985 0.1946 0.9003 0.5717 0.9309 0.6751 0.0059 0.8066 0.3491 0.9533 0.3944 0.9789 0.9695 0.5592 0.4562 0.6864 0.3417 0.3323 0.3897 0.4169 0.8721 0.6156 0.0335 0.8445 0.0683 0.7964 0.9663 0.8080 0.0808 0.8780 0.7268 0.8301 0.8193 0.8844 0.2560 0.4625 0.1062 0.1856 0.4561 0.1907 0.3908 0.9842 0.4527 0.3240 0.4405 0.4386 0.0473 0.1558 0.6332 0.7939 0.9727 0.6248 0.9080 A(:,:,6) = 0.6052 0.2922 0.5163 0.6522 0.0271 0.3688 0.4156 0.5814 0.2656 0.3809 0.4067 0.4959 0.3239 0.8494 0.6546 0.7848 0.7399 0.1099 0.0632 0.6153 0.2935 0.8794 0.7786 0.1520 0.3621 0.2544 0.1270 0.9395 0.1288 0.7220 0.8397 0.9829 0.4101 0.8155 0.7125 0.7036 0.8537 0.7485 0.5452 0.8866 0.5715 0.5451 0.3881 0.4260 0.2390 0.0515 0.0057 0.6386 0.7064 0.7508 0.6311 0.7545 0.0456 0.7680 0.9041 0.1677 0.7022 0.8850 0.4806 0.3015 0.2629 0.8058 0.5035 0.2535 0.8649 0.6097 0.5858 0.7218 0.3383 0.9385 0.6260 0.3185 0.5665 0.0669 0.9097 0.4009 0.5147 0.5296 0.1287 0.1714 0.7079 0.7493 0.8893 0.6076 0.3351 0.3681 0.0553 0.4778 0.1821 0.9288 0.0512 0.5580 0.3008 0.2440 0.2574 0.5942 0.2393 0.6224 0.1469 0.5788 A(:,:,7) = 0.3595 0.1493 0.2383 0.3069 0.9012 0.8441 0.6794 0.9102 0.5277 0.0789 0.3963 0.4260 0.2418 0.6190 0.9039 0.4469 0.3532 0.7074 0.0373 0.0432 0.1812 0.6136 0.9413 0.1046 0.0411 0.4666 0.5664 0.2261 0.2410 0.5738 0.7486 0.8855 0.4119 0.6127 0.1154 0.2915 0.0043 0.1078 0.1544 0.0504 0.1160 0.1546 0.1409 0.1939 0.6894 0.5366 0.1656 0.6533 0.6818 0.4894 0.4304 0.5963 0.1955 0.9785 0.3015 0.1862 0.0894 0.4475 0.3631 0.4661 0.3066 0.8925 0.3824 0.2019 0.4303 0.8933 0.7205 0.1777 0.1713 0.2930 0.3383 0.7833 0.1737 0.4464 0.4835 0.8395 0.7120 0.5932 0.1596 0.2815 0.5659 0.4849 0.3784 0.4035 0.9033 0.6114 0.6271 0.8245 0.1596 0.8375 0.7973 0.7707 0.8823 0.1568 0.3310 0.5593 0.3220 0.9175 0.6539 0.7667 A(:,:,8) = 0.2453 0.9090 0.2138 0.2489 0.5941 0.7382 0.0481 0.2882 0.4896 0.2047 0.3644 0.9509 0.3949 0.0623 0.9492 0.2083 0.1694 0.5582 0.0890 0.1621 0.8155 0.2815 0.0737 0.0966 0.2452 0.9735 0.2337 0.3199 0.8917 0.0379 0.5784 0.7873 0.3121 0.3533 0.5460 0.7003 0.2633 0.8621 0.4367 0.0075 0.7218 0.7604 0.1090 0.6211 0.3351 0.4555 0.6046 0.9101 0.2373 0.4248 0.3461 0.8786 0.4972 0.1522 0.2659 0.2645 0.7411 0.9380 0.3174 0.2159 0.9363 0.2495 0.1308 0.3149 0.0052 0.5698 0.9593 0.3760 0.7105 0.4070 0.2954 0.0921 0.0784 0.3039 0.1046 0.9722 0.2882 0.6334 0.0489 0.3954 0.3429 0.9040 0.9537 0.6440 0.5687 0.8877 0.5783 0.2744 0.7289 0.6818 0.1998 0.2850 0.8373 0.0978 0.7367 0.1866 0.8102 0.6811 0.9400 0.4365 A(:,:,9) = 0.1422 0.1199 0.0215 0.8164 0.2438 0.2303 0.6491 0.2762 0.6688 0.5725 0.8134 0.2193 0.4181 0.6797 0.7326 0.4971 0.6611 0.4358 0.8930 0.3518 0.9353 0.4501 0.6983 0.5620 0.7706 0.2456 0.0207 0.4273 0.6858 0.0402 0.0234 0.7054 0.0183 0.8996 0.0369 0.6561 0.5467 0.1251 0.2954 0.9392 0.4675 0.1421 0.6567 0.2142 0.8080 0.4667 0.0981 0.2755 0.6030 0.5969 0.2940 0.2333 0.8574 0.9372 0.0370 0.2237 0.9141 0.5173 0.5808 0.1544 0.7907 0.4599 0.7970 0.2818 0.5846 0.9158 0.1186 0.9013 0.1718 0.9586 0.4413 0.7485 0.9022 0.8341 0.3052 0.3404 0.6719 0.9112 0.1848 0.6698 0.4112 0.3083 0.2790 0.5473 0.2977 0.0689 0.7332 0.4403 0.8441 0.5399 0.0371 0.5807 0.1356 0.0279 0.6775 0.6617 0.0843 0.6989 0.1769 0.6099 A(:,:,10) = 0.7932 0.2279 0.2973 0.9033 0.2519 0.2436 0.9310 0.3076 0.6147 0.8815 0.8312 0.3646 0.3354 0.0571 0.4814 0.5961 0.9124 0.1468 0.0917 0.5629 0.6334 0.5317 0.8704 0.7639 0.2141 0.2092 0.1980 0.4187 0.0021 0.4590 0.7799 0.4617 0.1400 0.3064 0.5356 0.3723 0.4581 0.3645 0.6359 0.6581 0.3769 0.0169 0.1002 0.8710 0.1163 0.1850 0.9849 0.9788 0.0425 0.1920 0.2631 0.4863 0.4108 0.4839 0.0083 0.0032 0.3310 0.0907 0.6703 0.3323 0.8523 0.1527 0.2694 0.4496 0.7425 0.8789 0.9165 0.2171 0.6543 0.4786 0.5957 0.0240 0.4455 0.9583 0.1033 0.0753 ...

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

8   Pass
A= 13.3; B = A; assert(isequal(your_fcn_name(A),B))

A = 13.3000