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
I don't see why "x(1):2:length(x)" doesn't work, but "x(1:2:length(x))" does if it's the same thing?
It worked for me in MATLAB
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
y = x(1:2:length(x));?
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 !
y = x(1:2:end);
nice
cool!
this question is ambiguity...
LOL, the solution is in the Test Suite :)
why wrong?
My program woks!
error in template
easy
y = x(1:2:length(x))
this was so easy
why is it we cant just see a correct answer once we've submitted enough wrong answers? That would actually improve learning time as opposed to going round in circles not knowing what to do.
Nice one!
Nice XU
Great to solve
Great to solve
How to view the leasing solution?
Nice and Easy
de dang va hay
Why doesn't this work??
nice!
what is this code means?
This same exact code has been posted for numerous problems and is not a true solution. It appears to be a way of hacking the Test Suite into accepting the code as a correct solution. It is also concise, so it always appears to be the "leading" solution. (I have only checked a handful of "leading solutions", so this is a conjecture on my part.)
The solution is given in the test suite!
works with numel(x) OR length(x)
Great!,A pretty useful problem to solve!
Good job!
keep up
nice
Nice!
very easy
please provide me the solution
good
nice
HAHAHAHA
nice
This solution is wrong. even if it is considered correct. This solution would eliminate elements with value equal to 0 as well.
I wrote:
function y = everyOther(x)
n=0;
for i=1:length(x)
if rem (i,2)==0
n=n+1
y(i-n)= x(i-1);
end
end
end
Could someone explain why it failed?
nice
You can improve it by doing: y = x(1:2:length(x));
nice
y = x(mod(x,2)==1);
why is it not working? it works in matlab
nice
I did the same thing...
Coding in my matlab2014 before submit is a good thicks.
nice
Still confused why my 'find' solution doesn't work
nice
Great i liked this
nice
Nice Job
nice
NICE JOB
try to minimize the size
nice
Is this unfair?
nice
vector concept is different with array.
nice
done
nice
nice
good
This problem is not clear to understand, you must return all the odd indexs.
if you want concise code,use
y = x(1:2:ceil(end/2)*2-1)
amazing problem
':' is superfluous but does mean it will work on matrices, not just vectors.
2527 Solvers
963 Solvers
3928 Solvers
3166 Solvers
1077 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!