Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = rand(1,10);
actual = everyOther(x);
expected = x(1:2:length(x));
assert(isequal(actual, expected))
ans =
0.8778 0.5034 0.0854 0.1650 0.5310
|
2 | Pass |
x = rand(1,100);
actual = everyOther(x);
expected = x(1:2:length(x));
assert(isequal(actual, expected))
ans =
Columns 1 through 18
0.2893 0.8757 0.1138 0.4476 0.4830 0.3005 0.9367 0.3536 0.6511 0.4363 0.4850 0.7228 0.1954 0.7037 0.2254 0.7907 0.7417 0.0098
Columns 19 through 36
0.2734 0.1237 0.1544 0.6029 0.5086 0.2314 0.2442 0.2624 0.6499 0.0914 0.8677 0.5586 0.2103 0.4168 0.4651 0.8395 0.7942 0.7278
Columns 37 through 50
0.6965 0.8759 0.7613 0.4378 0.9390 0.6820 0.3224 0.9433 0.2145 0.8611 0.5416 0.3623 0.3319 0.8923
|
3 | Pass |
x = ['A' 'long' 'time' 'ago' 'in' 'a' 'galaxy' 'far' 'far' 'away'];
actual = everyOther(x);
expected = x(1:2:length(x));
assert(isequal(actual, expected))
ans =
'Aogiegiaaayafrwy'
|
17484 Solvers
Maximum running product for a string of numbers
1112 Solvers
927 Solvers
302 Solvers
Check that number is whole number
1071 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!