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.9575 0.1576 0.9572 0.8003 0.4218
|
2 | Pass |
%%
x = rand(1,100);
actual = everyOther(x);
expected = x(1:2:length(x));
assert(isequal(actual, expected))
ans =
Columns 1 through 10
0.7922 0.6557 0.8491 0.6787 0.7431 0.6555 0.7060 0.2769 0.0971 0.6948
Columns 11 through 20
0.9502 0.4387 0.7655 0.1869 0.4456 0.7094 0.2760 0.6551 0.1190 0.9597
Columns 21 through 30
0.5853 0.7513 0.5060 0.8909 0.5472 0.1493 0.8407 0.8143 0.9293 0.1966
Columns 31 through 40
0.6160 0.3517 0.5853 0.9172 0.7572 0.3804 0.0759 0.5308 0.9340 0.5688
Columns 41 through 50
0.0119 0.1622 0.3112 0.1656 0.2630 0.6892 0.4505 0.2290 0.1524 0.5383
|
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
|
Extract leading non-zero digit
1205 Solvers
1159 Solvers
Back to basics 8 - Matrix Diagonals
781 Solvers
484 Solvers
376 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!