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.8941 0.4848 0.7194 0.3881 0.0568
|
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.9714 0.2489 0.5010 0.0562 0.7583 0.9155 0.5793 0.0141 0.0582 0.4075 0.3568 0.5534 0.6973 0.2861 0.0170 0.9451 0.5779 0.5132
Columns 19 through 36
0.7840 0.1089 0.4606 0.9869 0.2001 0.0606 0.8289 0.1127 0.1781 0.5118 0.1654 0.3388 0.8022 0.3885 0.0142 0.9684 0.8293 0.9306
Columns 37 through 50
0.2238 0.7126 0.6593 0.4816 0.3774 0.0504 0.0342 0.0212 0.7045 0.1546 0.8846 0.9722 0.1771 0.0519
|
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'
|
17222 Solvers
657 Solvers
2261 Solvers
Remove element(s) from cell array
373 Solvers
465 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!