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.1817 0.7962 0.9077 0.0222 0.2799 0.2952 0.7272 0.5871 0.7467 0.7071
0.4264 0.8071 0.7870 0.2192 0.6617 0.9600 0.6825 0.0858 0.1256 0.8503
0.1086 0.5482 0.6360 0 0.3728 0.5563 0.5638 0.8500 0.4105 0.4254
0.2754 0.5263 0.6265 0.6263 0.5898 0.4218 0.5211 0.4644 0.5272 0.1275
0.3301 0.8005 0.5006 0.9307 0.5412 0.1335 0.1853 0.6504 0.5958 0.7165
0.9684 0.7669 0.4562 0.4072 0.1071 0.6583 0.1158 0.2862 0.0334 0.9203
0.0171 0.1138 0.9411 0.5460 0.4649 0.9363 0.9235 0.7807 0.0627 0.6196
0.0285 0.0131 0.5084 0.2528 0.7554 0.0728 0.8462 0.4528 0.9535 0.7643
0.2733 0.2331 0.8806 0.8255 0.1486 0.6362 0.8548 0.0562 0.3872 0.2813
0.6733 0.0599 0.4484 0.9132 0.8673 0.0839 0.9644 0.5372 0.5938 0.4688
B(:,:,2) =
0.5994 0 0.9559 0.0368 0.5951 0.0581 0.6050 0.5605 0.4710 0.0137
0.3345 0.6406 0.2764 0.1919 0.5177 0.9409 0.2354 0.6104 0.4727 0.6363
0.0967 0.8898 0.8795 0.4902 0.8987 0.4026 0.0014 0.5409 0.8838 0.0975
0.5739 0.6361 0.1816 0.9893 0.3895 0.0571 0.4898 0.3213 0.0114 0.6369
0.1704 0.5777 0.9420 0.1151 0.5975 0.9219 0.8861 0.1427 0.1178 0.1677
0.4313 0.9859 0.9882 0.6653 0.3860 0.3448 0.0593 0.1770 0.6784 0.4865
0.9824 0.4225 0.1580 0.6899 0.5015 0.7185 0.1350 0.6408 0.9030 0.4082
0.9918 0.3584 0.5742 0.6779 0.2632 0.1451 0.2967 0.9853 0.5281 0.4539
0.8299 0.0253 0.1650 0.4566 0.6072 0.2428 0.3519 0.9424 0.2258 0.6123
0.2829 0.0095 0.6660 0.6153 0.8977 0.7891 0.0399 0.0343 0.3644 0.7545
B(:,:,3) =
0.0601 0.2323 0.8184 0.3736 0.9513 0.1966 0.7519 0.4374 0.6656 0.3382
0.3434 0.0280 0.1800 0.3195 0.9314 0.5445 0.8986 0.3952 0.6915 0.4678
0.6582 0.1291 0.3331 0.5749 0.0259 0.9601 0.2520 0.2590 0.0950 0.3067
0.3293 0.5660 0.5064 0.4722 0.8780 0.1773 0.9968 0.0188 0.4788 0.5363
0.4009 0.7871 0.2355 0.1794 0.8173 0 0.4676 0.0671 0.1356 0.7326
0.3068 0.0243 0.9698 0.1092 0.4979 0.0810 0.2325 0.0802 0.8007 0.7538
0.3911 0.7207 0.3946 0.7271 0.0229 0.1056 0.7868 0.1773 0.8954 0.0383
0.4025 0.2096 0.8104 0.9631 0.6567 0.6469 0.7958 0.2696 0.9638 0.1080
0.9819 0.6862 0.2245 0.3943 0.8810 0.0374 0.8296 0.3501 0.9830 0.7897
0.0368 0.6560 0.5334 0.9827 0.1089 0.6611 0.2332 0.8278 0.6332 0.9205
B(:,:,4) =
0.1992 0.9592 0.6162 0.0553 0.7141 0.6722 0.2833 0.8403 0.4726 0.1546
0.2865 0.5729 0.2389 0.6850 0.0308 0.4312 0.0589 0.6316 0.4614 0.3277
0.9099 0.7854 0.0241 0.5448 0.4362 0.5062 0.6868 0.7661 0.6248 0.5603
0.8116 0.8965 0.8258 0.5447 0.5761 0.8842 0.8939 0.4285 0.3494 0.9421
0.0961 0.1475 0.4681 0.7358 0.6763 0.7797 0.4389 0.1188 0.1304 0.2983
0.1705 0.0989 0.5382 0.6258 0.8853 0.5524 0.2866 0.7912 0.4137 0.8131
0.6043 0.6006 0.6051 0.4549 0.7260 0.9729 0.9073 0.7864 0.2375 0.6091
0.5570 0.5175 0.5063 0.2636 0.4522 0.0654 0.4105 0.3636 0.5439 0.9543
0.1681 0.6214 0.2242 0.2008 0.6636 0.5027 0.2725 0.1958 0.0634 0.2964
0.5750 0.4194 0.7808 0.7279 0.1554 0.9469 0.2672 0.4124 0.1578 0.4914
B(:,:,5) =
0.2514 0.2035 0.0057 0.6728 0.6171 0.8918 0.1391 0.4172 0.1176 0.1263
0.0284 0.9447 0.3264 0.9483 0.7584 0.6408 0.9167 0.6720 0.3350 0.5180
0.6153 0.7577 0.2771 0.5133 0.7365 0.6014 0.6396 0.1739 0.8925 0.0057
0.4860 0.3606 0.9493 0.2343 0.6825 0.0734 0.2384 0.1380 0.8893 0.6969
0.9036 0.7954 0.5538 0.2323 0.3834 0.4008 0.3694 0.0977 0.7064 0.4531
0.4070 0.9739 0.4774 0.2529 0.8294 0.1262 0.9224 0.5166 0.5805 0.0443
0.2496 0.5211 0.0845 0.4415 0.1462 0.3385 0.4060 0.6961 0.2007 0.2214
0.7885 0.9544 0.8440 0.8237 0.5404 0.1445 0.7882 0.1628 0.8631 0.3822
0.7384 0.3703 0.4935 0.3910 0.6667 0.0711 0.1348 0.1264 0.5538 0.2811
0.0505 0.0980 0.6390 0.0408 0.0260 0.2934 0.6109 0.9858 0.4123 0.5394
B(:,:,6) =
0.0063 0.8187 0.7751 0.2965 0.8134 0.5984 0.8763 0.0039 0.0617 0.8445
0.5508 0.0696 0.1238 0.2269 0.8087 0.6803 0.4695 0.2153 0.3308 0.3512
0.5046 0.1620 0.5023 0.1417 0.0566 0.0709 0.9872 0.4936 0.4475 0.5214
0.3785 0.1249 0.6270 0.0164 0.4588 0.4439 0.5474 0.3795 0.5220 0.0112
0.7093 0.1147 0.1766 0.0306 0.7330 0.1448 0.5020 0.6505 0.9867 0.9139
0.9170 0.3767 0.4847 0.8622 0.9623 0.6604 0.7766 0.3700 0.1102 0.8879
0.3482 0.9653 0.0746 0.7206 0.8882 0.4107 0.8100 0.9958 0.8963 0.3628
0.7054 0.7317 0.2892 0.7524 0.7856 0.3376 0.9399 0.0611 0.9868 0.0595
0.1293 0.1582 0.3063 0.4611 0.5559 0.3649 0.0318 0.8602 0.8486 0.8537
0.6677 0.7852 0.2148 0.0630 0.6291 0.8815 0.5658 0.5861 0.2743 0.5014
B(:,:,7) =
0.8998 0.6589 0.1649 0.1356 0.4396 0.3616 0.1751 0.9040 0.9421 0.0549
0.2850 0.5536 0.2494 0.8987 0.2258 0.2928 0.1339 0.5287 0.1374 0.3630
0.4672 0.3179 0.3852 0.0719 0.6111 0.0508 0.9804 0.5199 0.3869 0.3914
0.2852 0.2039 0.6451 0.0673 0.3477 0.2105 0.2421 0.2808 0.5696 0.0244
0.2886 0.1058 0.8122 0.3762 0.0954 0.5320 0.1497 0.5770 0.6170 0.3285
0.1344 0.5685 0.8500 0.3688 0.5129 0.4076 0.6686 0.0363 0.2243 0.4684
0.2938 0.6051 0.6592 0.8498 0.2117 0.3017 0.0977 0.9244 0.8084 0.3730
0.5475 0.9614 0.2573 0.4361 0.1574 0.6794 0.8189 0.2053 0.2309 0.0875
0.0598 0.0317 0.8987 0.3905 0.4708 0.7491 0.3210 0.1966 0.0372 0.6184
0.6815 0.2122 0.8576 0.1986 0.6028 0.6509 0.0590 0.4672 0.8331 0.5229
B(:,:,8) =
0.8948 0.7863 0.7962 0.0407 0.4246 0.7899 0.6450 0.4123 0.3658 0.1852
0.3886 0.3912 0.6597 0.8129 0.1505 0.5813 0.3414 0.2277 0.7417 0.7735
0.4705 0.0018 0.7107 0.5328 0.0927 0.8552 0.3380 0.9257 0.1701 0.7990
0.3582 0.6915 0.0940 0.4626 0.9329 0.4588 0.0718 0.6755 0.9402 0.0546
0.2478 0.0365 0.0958 0.6737 0.5174 0.6554 0.8649 0.7398 0.4627 0.8914
0.7125 0.3985 0.5766 0.5482 0.1622 0.0249 0.6400 0.4926 0.3143 0.4850
0.0620 0.4053 0.5186 0.4270 0.0201 0.4014 0.1773 0.4483 0.1367 0.8276
0.9658 0.3709 0.7614 0.0949 0.3023 0.7007 0.9632 0.7703 0.0525 0.8574
0.5372 0.6926 0.0351 0.1659 0.4874 0.9743 0.4344 0.0926 0.5152 0.5550
0.4190 0.9383 0.0944 0.4064 0.0748 0.5760 0.8501 0.7945 0.3517 0.8353
B(:,:,9) =
0.4781 0.3027 0.2382 0.0977 0.5960 0.4641 0.1194 0.9635 0.5538 0.0084
0.9628 0.9216 0.2795 0.6580 0.5028 0.0187 0.0183 0.7205 0.1380 0.1236
0.2681 0.7590 0.6578 0.5979 0.8454 0.5271 0.6092 0.6534 0.5948 0.3533
0.2479 0.8896 0.9163 0.8793 0.4780 0.8083 0.9058 0.7860 0.1028 0.3982
0.8189 0.6813 0.0933 0.5077 0.9674 0.9624 0.9045 0.1853 0.2793 0.0534
0.9686 0.6422 0.1358 0.7648 0.1029 0.8333 0.8285 0.9363 0.0190 0.7580
0.9101 0.8744 0.1942 0.5866 0.7070 0.6786 0.1931 0.7778 0.8235 0.1152
0.6302 0.9122 0.9111 0.0427 0.7980 0.7268 0.0758 0.3329 0.7004 0.5113
0.7003 0.1372 0.8347 0.9710 0.1774 0.2586 0.4232 0.5594 0.2970 0.8387
0.1495 0.9683 0.5182 0.5208 0.3887 0.9303 0.0389 0.6308 0.4411 0.3069
B(:,:,10) =
0.4717 0.8821 0.5424 0.9370 0.7062 0.7609 0.5310 0.6598 0.8528 0.5267
0.8393 0.1303 0.9399 0.9403 0.7702 0.2073 0.4569 0.4541 0.3219 0.6631
0.8149 0.3064 0.7223 0.5786 0.3232 0.8168 0.5785 0.7455 0.5382 0.1237
0.2784 0.5390 0.2219 0.2463 0.4571 0.8264 0.6683 0.0329 0.8928 0.7698
0.9921 0.7457 0.3298 0.0265 0.0950 0.2035 0.2812 0.2754 0.1114 0.8819
0.2571 0.7262 0.7924 0.2606 0.7668 0.8898 0.0601 0.6971 0.6329 0.7415
0.1334 0.7226 0.7631 0.4509 0.9453 0.4772 0.9569 0.7177 0.8583 0.0421
0.0363 0.7337 0.0063 0.7426 0.4176 0.6165 ...
|
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 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
|
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
|
Is my wife right? Now with even more wrong husband
1241 Solvers
Make one big string out of two smaller strings
1149 Solvers
Fahrenheit to Celsius converter
358 Solvers
Find last zero for each column
239 Solvers
486 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!