Problem 6. Select every other element of a vector
Solution Stats
Problem Comments
-
38 Comments
Not clear.
What does it mean? It is not clear
It's not understandable.
This problem is definitely not clear.
Select the first, the third, the fifth, the seventh, ... element.
nice problem
I cant understand this problem.
nice
All solutions with score 10 or 11 use the regexp cheat.
very good one
Yes, you should change the redaction of the problem,maybe
function y = everyOther(x)
for i=1:length(x)
if mod(x(i),2)~=0
y(i)=x(i)
end
end
y=y(y>0)
end
What's wrong with this solution?
y = x(mod(x,2)==1);
it's not working, and i cant see why
nice problem
nice
good
I can't understand, why is this wrong?
j=1;
for i=1:length(x)
if rem(x(i),2)~=0
y(j)=x(i);
j=j+1;
end
end
Nice problem, but I have been doing this with my son and it would be good if the exercises were more gently graduated with relevant syntax so he can learn without relying on his dad knowing Matlab!
I can't believe someone solved this with size 9.
The leading solution is not a solution. It just makes all the test assertions true.
Indexing is one of more important things in matlab and matrices. Gotta learn them good before heading on.
Helo, hey hey ey
Indexing is one of more important things in matlab and matrices. Gotta learn them good before heading on.
Test suite suggests solution !
nice
the example made confusion
cool!
nice!
cool!
hard
I overcomplicated this one at first, but once you figure it out, it's not too bad
Absolutely mind boggling
this one's pretty good
gg ez
I have a question is that :test6 and test7 is the column vector,but test1-5 is the row vector,
so if test 1-5 are passed ,the test 6 and 7 are not passed
这个问题出的有点问题,没有规范化
gg ez
OMG, It wasn't about finding the odd numbers?
Solution Comments
Show commentsProblem Recent Solvers32209
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
6161 Solvers
-
1892 Solvers
-
Find the maximum number of decimal places in a set of numbers
2767 Solvers
-
506 Solvers
-
1109 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!