Cody

Solution 1763293

Submitted on 27 Mar 2019 by Nuwan Senevirathne
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 13 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')

B = 13 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 = [] 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 = 13 0 13 13 13 8 13 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')

B(:,:,1) = 0.6029 0.3617 0.4288 0.7198 0.3928 0.4366 0.9950 0.2699 0.8724 0.3837 0.1517 0.6043 0.1369 0.8016 0.0696 0.0390 0.1435 0.2133 0.5734 0.7251 0.9021 0.5868 0.8915 13.0000 0.4502 0.6527 0.6200 0.3919 0.3906 0.0534 0.9157 0.3247 0.6617 0.0127 0.4403 0.7792 0.7908 0.0773 0.0820 0.4826 0.2004 0.8644 0.8727 0.4274 0.1993 0.7414 0.1297 0.5481 0.2599 0.9086 0.1034 0.5230 0.9337 0.4666 0.4337 0.8531 0.3298 0.3488 0.0078 0.8982 0.0580 0.7406 0.4010 0.9506 0.0978 0.8116 0.0832 0.0455 0.4432 0.1991 0.4700 0.6549 0.0278 0.5230 0.2327 0.6068 0.2685 0.6849 0.8814 0.0763 0.3742 0.0896 0.1775 0.0087 0.7667 0.4609 0.2743 0.9761 0.3495 0.2902 0.4343 0.4445 0.7008 0.2023 0.1726 0.1557 0.9004 0.2693 0.8225 0.7235 B(:,:,2) = 0.2541 13.0000 0.0350 0.4864 0.0681 0.4370 0.7709 0.6110 0.0394 0.4160 0.8257 0.6624 0.4023 0.5886 0.1226 0.2158 0.7080 0.8242 0.7730 0.6169 0.1446 0.7946 0.7345 0.1917 0.1339 0.5406 0.6407 0.9000 0.7401 0.8279 0.1742 0.1600 0.7942 0.3667 0.9629 0.1113 0.9394 0.6451 0.1003 0.3291 0.4233 0.8433 0.0064 0.7375 0.0337 0.5029 0.3923 0.5742 0.5113 0.3506 0.0758 0.0287 0.3183 0.0987 0.2983 0.6531 0.5577 0.2915 0.4306 0.3814 0.3715 0.6709 0.2626 0.8499 0.0656 0.7403 0.7357 0.2971 0.9674 0.7283 0.2532 0.5236 0.4470 0.0102 0.2468 0.9307 0.4803 0.7549 0.5179 0.3951 0.4600 0.4619 0.8775 0.1184 0.7608 0.8456 0.1921 0.8905 0.7207 0.8868 0.0951 0.7506 0.2229 0.1594 0.8582 0.5070 0.5267 0.4101 0.0915 0.0552 B(:,:,3) = 0.7949 0.4018 0.6835 0.8814 0.9623 0.5125 0.3523 0.0717 0.9779 0.4396 0.8670 0.5422 0.9080 0.2836 0.4914 0.7458 0.7897 0.7886 0.3684 0.5651 0.9636 0.2113 0.5286 0.9192 0.4094 0.9974 0.1436 0.9787 0.5894 0.0752 0.2703 0.4952 0.3018 0.3664 0.3714 0.6641 0.0574 0.6658 0.9505 0.0830 0.5479 0.5275 0.2171 0.6238 0.6052 13.0000 0.2744 0.0599 0.2699 0.3837 0.7050 0.4657 0.4297 0.7693 0.7377 0.6757 0.1024 0.2573 0.9499 0.6848 0.7239 0.8860 0.4782 0.5710 0.8278 0.0028 0.2173 0.7847 0.7249 0.9195 0.2161 0.9413 0.7946 0.3093 0.0775 0.1452 0.8020 0.6979 0.8269 0.2226 0.7974 0.4761 0.5398 0.1019 0.5148 0.0944 0.9225 0.0443 0.7885 0.3407 0.3473 0.7178 0.6986 0.6530 0.9439 0.7564 0.0508 0.1296 0.6152 0.5913 B(:,:,4) = 0.7763 0.5200 0.0446 0.0948 0.0999 0.3037 0.1150 0.9688 0.7295 0.4770 0.8808 0.9409 0.5173 0.4226 0.2483 0.9848 0.8124 0.5836 0.7277 0.6689 0.4411 0.2329 0.1933 0.9543 0.7908 0.5129 0.2240 0.4028 0.4828 0.1280 0.5301 0.8668 0.9532 0.7709 0.2909 0.1220 0.3885 0.1585 0.9889 0.6473 0.8732 0.0482 0.1527 0.6057 0.5194 0.4500 0.8711 0.3453 0.0487 0.4224 0.9831 0.4083 0.9117 0.5432 0.9569 0.1502 0.3516 0.6552 0.7650 0.1338 0.5122 0.0302 0.4909 0.3869 0.0113 0.4946 0.2026 0.8416 0.0787 0.7620 0.3399 0.5091 0.0588 0.9635 0.7658 0.5027 0.0503 0.9924 0.7575 0.5959 0.6030 0.6008 0.5246 0.3266 0.8222 0.7294 0.4349 0.1287 0.4548 0.9825 0.8663 0.4730 0.0844 0.2150 0.9822 0.9855 0.3234 0.5709 0.2761 0.5302 B(:,:,5) = 0.5256 0.3576 0.9328 0.1079 0.0420 0.5482 0.8616 0.2419 0.9033 0.8475 0.0160 0.6249 0.7200 0.5007 0.5301 0.8808 0.5564 0.4352 0.6096 0.8089 0.5779 0.1682 0.7145 0.8543 0.4543 0.9826 0.8128 0.3045 0.2347 0.2083 0.5565 0.0271 0.8503 0.6162 0.6987 0.8399 0.6106 0.2500 0.6313 0.3354 0.3759 0.7709 0.4757 0.0344 0.0432 0.4277 0.9426 0.5429 0.4259 0.4018 0.9332 0.0067 0.4392 0.5038 0.0737 0.6354 0.4785 0.6704 0.0934 0.8229 0.8378 0.2483 0.8645 0.5891 0.5465 0.0160 0.8363 0.0589 0.9303 0.7327 0.2285 0.9537 0.1356 0.4164 0.8871 0.5293 0.7374 0.1879 0.0342 0.2244 0.1494 0.6731 0.7744 0.2186 0.1705 0.0941 0.9200 0.0608 0.4679 0.1819 0.8043 0.9272 0.5040 0.0226 0.8955 0.3071 0.0750 0.7704 0.2702 0.7239 B(:,:,6) = 0.4956 0.3629 0.2758 0.3121 0.8992 0.1621 0.1301 0.1275 0.5887 0.4622 0.7608 0.7457 0.3799 0.6769 0.3178 0.1585 0.7053 0.9964 0.7167 0.3491 0.7073 0.3357 0.1511 0.2028 0.7813 0.2736 0.6201 0.7984 0.4774 0.5945 0.8437 0.5712 0.3086 0.6340 0.4036 0.0087 0.2251 0.8117 0.2826 0.1355 0.6579 0.6858 0.0749 0.1253 0.5248 0.5799 0.4686 0.4270 0.1950 0.7296 0.6050 0.6766 0.2188 0.6846 0.5902 0.5509 0.5376 0.2180 0.4687 0.7740 0.7565 0.8862 0.7715 0.8879 0.9487 0.6706 0.9567 0.7987 0.0556 0.7339 0.5562 0.3213 0.2641 0.3389 0.2659 0.7759 0.6825 0.0947 0.9106 0.5484 0.4742 0.1288 0.9416 0.3329 0.0008 0.0681 0.3867 0.6580 0.9201 0.6622 0.8248 0.9519 0.3352 0.5693 0.5947 0.1746 0.2972 0.7448 0.7018 0.0187 B(:,:,7) = 0.3013 0.7150 0.9868 0.7331 0.1628 0.0078 0.1674 0.6967 0.0680 0.9958 0.7706 0.1038 0.3998 0.6832 0.6007 0.6079 0.9427 0.7792 0.4248 0.3059 0.4017 0.1841 0.7614 0.7390 0.6251 0.0965 0.3927 0.4517 0.9383 0.1446 0.2458 0.4182 0.4252 0.0519 0.7377 0.4980 0.7221 0.8805 0.3562 0.7271 0.4765 0.1826 0.3254 0.3490 0.2029 0.9133 0.1185 0.6037 0.3287 0.2830 0.1492 0.4883 0.1230 0.0467 0.0334 0.2358 0.7192 0.1723 0.5560 0.4766 0.3626 0.7272 0.2489 0.9003 0.0740 0.3955 0.0417 0.8502 0.5025 0.6061 0.8519 0.4407 0.4147 0.8372 0.8737 0.4796 0.0598 0.0223 0.7114 0.7389 0.8775 0.9833 0.9328 0.9897 0.6401 0.3187 0.1743 0.4201 0.0041 0.3173 0.2825 0.3494 0.8540 0.3270 0.4781 0.1579 0.5384 0.7690 0.9273 0.5178 B(:,:,8) = 0.6222 0.5919 0.5648 0.2434 0.7640 0.5024 0.3574 0.5315 0.4543 0.8635 0.9854 0.3856 0.2747 0.2085 0.7547 0.1532 0.0643 0.6897 0.3767 0.4512 0.0012 0.8433 0.3732 0.8052 0.5822 0.2348 0.8412 0.1129 0.0907 0.1503 0.9000 0.4271 0.7508 0.7716 0.8057 0.4689 0.7993 0.0404 0.1947 0.0286 0.5949 0.9816 0.0175 0.4019 0.8315 0.6958 0.6363 0.7646 0.8120 0.1766 0.4122 0.3361 0.3590 0.2539 0.1993 0.7679 0.0961 0.7878 0.7145 0.9266 0.6956 0.8083 0.2980 0.9653 0.9950 0.2438 0.0651 0.9936 0.2001 0.2920 0.1716 0.4733 0.1611 0.7232 0.7258 0.6935 0.2886 0.0419 0.6236 0.6786 0.8244 0.2610 0.1595 0.9341 0.7798 0.7161 0.5287 0.4786 0.9915 0.1378 0.6550 0.2332 0.8112 0.7523 0.6063 0.8242 0.7635 0.9880 0.7612 0.7553 B(:,:,9) = 0.8138 0.6539 0.9274 0.6329 0.1615 0.7265 0.2252 0.7948 0.3692 0.3229 0.9875 0.7137 0.5345 0.1018 0.4738 0.2445 0.5752 0.6444 0.3910 0.0884 0.7258 0.3856 0.0626 0.8392 0.2499 0.4147 0.4057 0.9670 0.3390 0.0734 0.4087 0.1956 0.5128 0.4282 0.0589 0.6982 0.4085 0.7572 0.3239 0.7912 0.0915 0.5325 0.0454 0.7140 0.2681 0.2738 0.8306 0.4209 0.8411 0.4981 0.5057 0.3265 0.0915 0.1671 0.1018 0.6659 0.8082 0.2527 0.4066 0.0318 0.9119 0.9421 0.6240 0.1759 0.0415 0.4870 0.2698 0.9324 0.6774 0.2896 0.5573 0.4255 0.7280 0.5962 0.6901 0.8988 0.2734 0.1791 0.5537 0.9298 0.4995 0.0334 0.1843 0.7639 0.5369 0.5527 0.7038 0.4991 0.7374 0.7724 0.0352 0.4528 0.1682 0.5580 0.1908 0.1388 0.8040 0.1891 0.9051 0.4600 B(:,:,10) = 0.3353 0.0661 0.6180 0.2430 0.9639 0.7797 0.5922 0.4732 0.6848 0.1290 0.1066 0.0428 0.9233 0.5022 0.0918 0.5096 0.8709 0.4570 0.8931 0.3979 0.2849 0.6296 0.4265 0.6594 0.5023 0.0839 0.4808 0.1332 0.5659 0.7764 0.3287 0.9786 0.2961 0.0510 0.4565 0.9717 0.4127 0.1368 0.5736 0.4123 0.2761 0.0643 0.6535 0.4382 0.2306 0.0820 0.5066 0.2836 0.1437 0.8688 0.3149 0.3563 0.0293 0.5474 0.7992 0.7128 0.4638 0.2368 0.8150 0.1384 0.8036 0.5722 0.7755 0.0815 0.7137 0.6293 0.0027 0.1843 0.7975 0.1941 0.8480 0.8834 0.1425 0.9115 0.2584 0.4529 ...

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 = 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 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 B = 17 24 1 8 15 23 5 7 14 16 4 6 13 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 B = 13.3000