Cody

Solution 1057358

Submitted on 21 Nov 2016 by JAEHYUK WOO
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 y = 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 y = 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 = [] y = []

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 y = 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) = Columns 1 through 9 0.9234 0.6574 0.7162 0.6917 0.1338 0.3653 0.3709 0.5831 0.4953 0.5555 0.2263 0.1931 0.9975 0.6782 0.6674 0.0596 0.8846 0.8602 0.2785 0.9743 0.9024 0 0.9295 0.0066 0.9933 0.6485 0.6793 0.9625 0.4094 0.9474 0.6066 0.1696 0.1735 0.2403 0.6203 0.6203 0.2887 0.3042 0.2487 0.2569 0.0412 0.2946 0.4195 0.9165 0.1839 0.4999 0.5336 0.3363 0.2123 0.5199 0.6464 0.9471 0.4829 0.7344 0.1307 0.2588 0.1222 0.9639 0.4973 0.7733 0.7200 0.1095 0.2815 0.0534 0.7748 0.5476 0.9959 0.6177 0.5098 0.4881 0.8504 0.1992 0.0572 0.4423 0.5088 0.4943 0.0996 0.8470 0.9260 0.2647 0.2745 0.2010 0.4895 0.0600 0.8838 0.1500 0.0724 0.3833 0.4464 0.4339 Column 10 0.4517 0.3027 0.6490 0.5878 0.7318 0.5636 0.0589 0.2515 0.3642 0.8833 A(:,:,2) = Columns 1 through 9 0.8312 0 0.2016 0.8650 0.3050 0.9226 0.7178 0.5653 0.5314 0.2198 0.2656 0.1139 0.7633 0.4921 0.0285 0.5438 0.9250 0.8370 0.4635 0.2245 0.7229 0.0131 0.7176 0.1763 0.8916 0.4038 0.2857 0.7897 0.5898 0.3161 0.8924 0.5041 0.4725 0.7915 0.3217 0.9700 0.1753 0.5694 0.4212 0.5194 0.6217 0.6709 0.2378 0.3831 0.3603 0.8971 0.3624 0.2794 0.0879 0.3009 0.2249 0.6877 0.4798 0.1124 0.5331 0.6304 0.5304 0.1321 0.0193 0.5045 0.1379 0.7400 0.4842 0.9723 0.5845 0.8972 0.9646 0.3173 0.6995 0.5350 0.1139 0.9053 0.8145 0.4605 0.4791 0.8025 0.2377 0.0510 0.0743 0.9418 0.6868 0.3860 0.6322 0.7694 0.8904 0.0168 0.7957 0.4521 0.3086 0.8143 Column 10 0.3282 0.1921 0.9190 0.3743 0.3353 0.0858 0.6977 0.0485 0.7128 0.9641 A(:,:,3) = Columns 1 through 9 0.1596 0.2074 0.7220 0.4924 0.2376 0.4314 0.3610 0.3345 0.3192 0.1627 0.8058 0.8273 0.3399 0.1537 0.1342 0.9865 0.5638 0.6382 0.4576 0.3937 0.6776 0.6252 0.1020 0.3438 0.0780 0.1765 0.6062 0.4898 0.9431 0.9010 0.4605 0.7821 0.1015 0.7182 0.7083 0.8374 0.4201 0.2978 0.0089 0.2116 0.2264 0 0.4185 0.7616 0.1567 0.8505 0.3906 0.2813 0.1628 0.4617 0.9332 0.8482 0.4588 0.6178 0.4773 0.1057 0.0112 0.5307 0.0059 0.3349 0.3687 0.3040 0.1539 0.8753 0.5466 0.8892 0.1962 0.3771 0.7188 0.9317 0.2768 0.8603 0.2698 0.5560 0.1011 0.3787 0.9242 0.0194 0.2621 0.2646 0.2300 0.0646 0.2870 0.4929 0.2001 0.4553 0.6057 0.2437 0.0045 0.4339 Column 10 0.0382 0.7247 0.6330 0.4980 0.5499 0.7710 0.3323 0.0328 0.4577 0.5521 A(:,:,4) = Columns 1 through 9 0.6349 0.0594 0.1745 0.6386 0.5689 0.0357 0.2784 0.8511 0.8236 0.7015 0.8940 0.1035 0.1206 0.8906 0.9945 0.3473 0.9747 0.8054 0.3271 0.0257 0.2692 0.8413 0.6145 0.2573 0.2155 0.8166 0.4541 0.9691 0.4684 0.3517 0.4772 0.3829 0.4769 0.3640 0.6443 0.8592 0.1629 0.5002 0.3375 0.0112 0.4477 0.6254 0.6505 0.6391 0.2588 0.4055 0.5222 0.7940 0.5382 0.4818 0.9777 0.3646 0.2500 0.4453 0.4836 0.7983 0.0189 0.0203 0.8176 0.2543 0.9294 0.3336 0.3354 0.8715 0.3346 0.2985 0.7790 0.3511 0.2538 0.2434 0.8364 0.4835 0.2594 0.4374 0.8876 0.1898 0.7505 0.3320 0.4038 0.6422 0.4355 0.8893 0.6249 0.2889 0.1178 0.4894 0.3358 0.9907 0.4399 0.8829 Column 10 0.7977 0.0756 0.1200 0.8198 0.7866 0.1036 0.8625 0.1618 0.7403 0.2349 A(:,:,5) = Columns 1 through 9 0.7509 0.1920 0.4422 0.0728 0.9449 0.4138 0.3809 0.9368 0.5637 0.3950 0.8350 0.3920 0.5764 0.5561 0.7372 0.3893 0.0809 0.4283 0.8521 0.7344 0.8691 0.4196 0.5877 0.6068 0.7942 0.8188 0.8025 0.0992 0.7025 0.5112 0.1537 0.2711 0.0288 0.4608 0.8831 0.9810 0.5713 0.7362 0.6878 0.7789 0.3319 0.7310 0.6179 0.0317 0.2760 0.3237 0.8352 0.6872 0.5205 0.0516 0.3759 0.3773 0.9429 0.7850 0.3520 0.2833 0.1245 0.7628 0.2432 0.0601 0.1820 0.5781 0.6232 0.9088 0.4691 0.0474 0.2691 0.2599 0.8756 0.7855 0.3234 0.0229 0.4388 0.8732 0.0371 0.8136 0.5273 0.6181 0.8622 0.9798 0.5900 0.6915 0.4499 0.6145 0.8991 0.9279 0.4242 0.3330 0.5283 0.5717 Column 10 0.2261 0.6693 0.2646 0.8835 0.2438 0.3016 0.0052 0.5543 0.9721 0.2838 A(:,:,6) = Columns 1 through 9 0.0803 0.3351 0.7955 0.9547 0.9558 0.6614 0.6914 0.4419 0.5147 0.7387 0.3820 0.9262 0.5866 0.3278 0.5927 0.7077 0.1383 0.0176 0.7638 0.2300 0.6819 0.5050 0.0591 0.0744 0.5287 0.5363 0.9338 0.6575 0.1490 0.5398 0.6662 0.2986 0.6766 0.6425 0.2551 0.6739 0.7999 0.2990 0.0947 0.1078 0.2952 0.5235 0.3355 0.4465 0.2132 0.3833 0.0084 0.7989 0.9756 0.7337 0.8026 0.8630 0.9574 0.4697 0.7211 0.3362 0.6923 0.2806 0.0676 0.0046 0.8877 0.4934 0.2948 0.7448 0.0405 0.0539 0.4178 0.9820 0.8726 0.7083 0.9200 0.0394 0.8350 0.6370 0.3205 0.0246 0.8673 0.3625 0.6420 0.6932 0.3563 0.7997 0.7523 0.0322 0.9351 0.2641 0.2922 0.4164 0.3263 0.0868 Column 10 0.7603 0.1107 0.0942 0.8270 0.8550 0.6729 0.6410 0.9563 0.1465 0.6680 A(:,:,7) = Columns 1 through 9 0.3465 0.6354 0.7381 0.2315 0.3727 0.8331 0.4679 0.6572 0.6367 0.3453 0.1490 0.5440 0.1215 0.2354 0.5014 0.1584 0.4062 0.9319 0.0584 0.5538 0.5845 0.7781 0.9256 0.3143 0.7217 0.3920 0.2383 0.1622 0.6220 0.6610 0.1883 0.7483 0.7683 0.1052 0.0647 0.2734 0.8782 0.4274 0.3296 0.2498 0.9297 0.3460 0.4186 0.1794 0.8937 0.2869 0.6330 0.6415 0.8218 0.8390 0.3843 0.7060 0.3831 0.0643 0.3883 0.3305 0.3257 0.0795 0.3191 0.2727 0.5581 0.9163 0.3648 0.9878 0.4780 0.6016 0.8302 0.2569 0.4605 0.9049 0.9841 0.6798 0.6577 0.8547 0.8986 0.5777 0.3173 0.7253 0.4917 0.1758 0.3107 0.1644 0.9666 0.8906 0.3459 0.9138 0.3791 0.1389 0.7744 0.8998 Column 10 0.4045 0.1044 0.1048 0.4770 0.7805 0.3624 0.2639 0.9278 0.6781 0.0543 A(:,:,8) = Columns 1 through 9 0.2636 0.1385 0.6010 0.7508 0.9829 0.0622 0.5206 0.9145 0.8890 0.4095 0.9370 0.0509 0.7257 0.7071 0.7852 0.0841 0.2160 0.0773 0.5023 0.8266 0.5698 0.2921 0.2056 0.7729 0.4460 0.0400 0.8312 0.1601 0.2061 0.1003 0.8167 0.2534 0.3502 0.5168 0.0871 0.6099 0.0206 0.7030 0.8725 0.0945 0.8500 0.3915 0.6570 0.7029 0.3343 0.7719 0.5944 0.0015 0.1730 0.5026 0.6142 0.9141 0.1906 0.1535 0.4457 0.6557 0.4487 0.0221 0.3178 0.4312 0.8182 0.4095 0.8930 0.3837 0.7083 0.3360 0.2284 0.9726 0.8587 0.5233 0.6176 0.2943 0.4581 0.2741 0.4225 0.8652 0.9847 0.8179 0.8194 0.2652 0.8929 0.7079 0.7636 0.5718 0.2739 0.8670 0.7442 0.2743 0.8410 0.6039 Column 10 0.6036 0.0631 0.5669 0.1224 0.3791 0.9670 0.5147 0.6026 0.1169 0.2633 A(:,:,9) = Columns 1 through 9 0.1451 0.5807 0.8216 0.8228 0.1082 0.3994 0.2501 0.8255 0.7369 0.4096 0.3953 0.7992 0.3473 0.4294 0.5072 0.7801 0.9586 0.1831 0.5544 0.7952 0.5984 0.4577 0.2760 0.8627 0.3197 0.2389 0.7115 0.5373 0.2830 0.0783 0.9888 0.6220 0.4520 0.0251 0.5862 0.9695 0.9599 0.3508 0.0191 0.5914 0.6061 0.1715 0.9938 0.8595 0.8232 0.7001 0.0450 0.7040 0.6353 0.4669 0.8261 0.6374 0.7876 0.4656 0.0884 0.2665 0.7334 0.0412 0.7918 0.9088 0.2981 0.3190 0.8532 0.5380 0.3518 0.4037 0.3874 0.3021 0.1058 0.1801 0.9913 0.9102 0.7547 0.3179 0.3915 0.1423 0.8522 0.7900 0.0570 0.8675 0.2743 0.4874 0.9687 0.2486 0.9219 0.1489 0.2050 0.0671 0.3789 0.0643 Column 10 0.1412 0.6868 0.3943 0.8689 0.2196 0.3712 0.9104 0.0235 0.5860 0.1341 A(:,:,10) = Columns 1 through 9 0.1159 0.5896 0.7832 0.8628 0.0388 0.9009 0.3988 0.7288 0.6641 0.7912 0.2133 0.1039 0.5875 0.7869 0.9250 0.3582 0.9636 0.0435 0.1396 0.4044 0.4510 0.5729 0.7940 0.4146 0.4092 0.7244 0.0881 0.1408 0.7339 0.1912 0.3320 0.8976 ...

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 = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 y = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 y = 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 y = 13.3000