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))
|
28010 Solvers
1601 Solvers
546 Solvers
Basics: 'Find the eigenvalues of given matrix
323 Solvers
Given a 4x4 matrix, swap the two middle columns
516 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!