Cody

Solution 1956388

Submitted on 2 Oct 2019 by Nikolaos Nikolaou
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
assessFunctionAbsence({'regexp','regexpi','regexprep','str2num'},'FileName','counter.m')

2   Pass
f = counter(0,1); assert(isequal(f(),0)) assert(isequal(f(),1)) assert(isequal(2,f())) assert(isequal(3,f()))

count = 0 count = 1 count = 2 count = 3

3   Pass
f = counter(1,0); assert(isequal(f(),1)) assert(isequal(f(),1)) assert(isequal(1,f())) assert(isequal(1,f()))

count = 1 count = 1 count = 1 count = 1

4   Pass
f = counter(10,2); assert(isequal(f(),10)) assert(isequal(f(),12)) assert(isequal(14,f())) assert(isequal(16,f()))

count = 10 count = 12 count = 14 count = 16

5   Pass
f = counter(0,5); y_correct = [0, 5, 10, 15, 20, 55]; assert(isequal([f() f() f() f() f() f()+f()],y_correct))

count = 0 count = 5 count = 10 count = 15 count = 20 count = 25 count = 30

6   Pass
x0 = randi(10); b = randi(10); f = counter(x0,b); y_correct = x0 + (0:1000)*b; assert(isequal(arrayfun(@(n)f(),0:1000),y_correct))

count = 9 count = 19 count = 29 count = 39 count = 49 count = 59 count = 69 count = 79 count = 89 count = 99 count = 109 count = 119 count = 129 count = 139 count = 149 count = 159 count = 169 count = 179 count = 189 count = 199 count = 209 count = 219 count = 229 count = 239 count = 249 count = 259 count = 269 count = 279 count = 289 count = 299 count = 309 count = 319 count = 329 count = 339 count = 349 count = 359 count = 369 count = 379 count = 389 count = 399 count = 409 count = 419 count = 429 count = 439 count = 449 count = 459 count = 469 count = 479 count = 489 count = 499 count = 509 count = 519 count = 529 count = 539 count = 549 count = 559 count = 569 count = 579 count = 589 count = 599 count = 609 count = 619 count = 629 count = 639 count = 649 count = 659 count = 669 count = 679 count = 689 count = 699 count = 709 count = 719 count = 729 count = 739 count = 749 count = 759 count = 769 count = 779 count = 789 count = 799 count = 809 count = 819 count = 829 count = 839 count = 849 count = 859 count = 869 count = 879 count = 889 count = 899 count = 909 count = 919 count = 929 count = 939 count = 949 count = 959 count = 969 count = 979 count = 989 count = 999 count = 1009 count = 1019 count = 1029 count = 1039 count = 1049 count = 1059 count = 1069 count = 1079 count = 1089 count = 1099 count = 1109 count = 1119 count = 1129 count = 1139 count = 1149 count = 1159 count = 1169 count = 1179 count = 1189 count = 1199 count = 1209 count = 1219 count = 1229 count = 1239 count = 1249 count = 1259 count = 1269 count = 1279 count = 1289 count = 1299 count = 1309 count = 1319 count = 1329 count = 1339 count = 1349 count = 1359 count = 1369 count = 1379 count = 1389 count = 1399 count = 1409 count = 1419 count = 1429 count = 1439 count = 1449 count = 1459 count = 1469 count = 1479 count = 1489 count = 1499 count = 1509 count = 1519 count = 1529 count = 1539 count = 1549 count = 1559 count = 1569 count = 1579 count = 1589 count = 1599 count = 1609 count = 1619 count = 1629 count = 1639 count = 1649 count = 1659 count = 1669 count = 1679 count = 1689 count = 1699 count = 1709 count = 1719 count = 1729 count = 1739 count = 1749 count = 1759 count = 1769 count = 1779 count = 1789 count = 1799 count = 1809 count = 1819 count = 1829 count = 1839 count = 1849 count = 1859 count = 1869 count = 1879 count = 1889 count = 1899 count = 1909 count = 1919 count = 1929 count = 1939 count = 1949 count = 1959 count = 1969 count = 1979 count = 1989 count = 1999 count = 2009 count = 2019 count = 2029 count = 2039 count = 2049 count = 2059 count = 2069 count = 2079 count = 2089 count = 2099 count = 2109 count = 2119 count = 2129 count = 2139 count = 2149 count = 2159 count = 2169 count = 2179 count = 2189 count = 2199 count = 2209 count = 2219 count = 2229 count = 2239 count = 2249 count = 2259 count = 2269 count = 2279 count = 2289 count = 2299 count = 2309 count = 2319 count = 2329 count = 2339 count = 2349 count = 2359 count = 2369 count = 2379 count = 2389 count = 2399 count = 2409 count = 2419 count = 2429 count = 2439 count = 2449 count = 2459 count = 2469 count = 2479 count = 2489 count = 2499 count = 2509 count = 2519 count = 2529 count = 2539 count = 2549 count = 2559 count = 2569 count = 2579 count = 2589 count = 2599 count = 2609 count = 2619 count = 2629 count = 2639 count = 2649 count = 2659 count = 2669 count = 2679 count = 2689 count = 2699 count = 2709 count = 2719 count = 2729 count = 2739 count = 2749 count = 2759 count = 2769 count = 2779 count = 2789 count = 2799 count = 2809 count = 2819 count = 2829 count = 2839 count = 2849 count = 2859 count = 2869 count = 2879 count = 2889 count = 2899 count = 2909 count = 2919 count = 2929 count = 2939 count = 2949 count = 2959 count = 2969 count = 2979 count = 2989 count = 2999 count = 3009 count = 3019 count = 3029 count = 3039 count = 3049 count = 3059 count = 3069 count = 3079 count = 3089 count = 3099 count = 3109 count = 3119 count = 3129 count = 3139 count = 3149 count = 3159 count = 3169 count = 3179 count = 3189 count = 3199 count = 3209 count = 3219 count = 3229 count = 3239 count = 3249 count = 3259 count = 3269 count = 3279 count = 3289 count = 3299 count = 3309 count = 3319 count = 3329 count = 3339 count = 3349 count = 3359 count = 3369 count = 3379 count = 3389 count = 3399 count = 3409 count = 3419 count = 3429 count = 3439 count = 3449 count = 3459 count = 3469 count = 3479 count = 3489 count = 3499 count = 3509 count = 3519 count = 3529 count = 3539 count = 3549 count = 3559 count = 3569 count = 3579 count = 3589 count = 3599 count = 3609 count = 3619 count = 3629 count = 3639 count = 3649 count = 3659 count = 3669 count = 3679 count = 3689 count = 3699 count = 3709 count = 3719 count = 3729 count = 3739 count = 3749 count = 3759 count = 3769 count = 3779 count = 3789 count = 3799 count = 3809 count = 3819 count = 3829 count = 3839 count = 3849 count = 3859 count = 3869 count = 3879 count = 3889 count = 3899 count = 3909 count = 3919 count = 3929 count = 3939 count = 3949 count = 3959 count = 3969 count = 3979 count = 3989 count = 3999 count = 4009 count = 4019 count = 4029 count = 4039 count = 4049 count = 4059 count = 4069 count = 4079 count = 4089 count = 4099 count = 4109 count = 4119 count = 4129 count = 4139 count = 4149 count = 4159 count = 4169 count = 4179 count = 4189 count = 4199 count = 4209 count = 4219 count = 4229 count = 4239 count = 4249 count = 4259 count = 4269 count = 4279 count = 4289 count = 4299 count = 4309 count = 4319 count = 4329 count = 4339 count = 4349 count = 4359 count = 4369 count = 4379 count = 4389 count = 4399 count = 4409 count = ...