y = x(mod(x,2)==1);
why is it not working? it works in matlab
nice
I did the same thing...
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
x = rand(1,10);
actual = everyOther(x);
expected = x(1:2:length(x));
assert(isequal(actual, expected))
|
2 | Fail |
x = rand(1,100);
actual = everyOther(x);
expected = x(1:2:length(x));
assert(isequal(actual, expected))
|
3 | Fail |
x = ['A' 'long' 'time' 'ago' 'in' 'a' 'galaxy' 'far' 'far' 'away'];
actual = everyOther(x);
expected = x(1:2:length(x));
assert(isequal(actual, expected))
|
Replace NaNs with the number that appears to its left in the row.
2018 Solvers
17128 Solvers
Duplicate each element of a vector.
518 Solvers
The Answer to Life, the Universe, and Everything
383 Solvers
There are 10 types of people in the world
310 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!