Cody

Problem 6. Select every other element of a vector

Created by Cody Team in Cody Challenge

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, starting with the first.

Examples:

 Input  x = [1 3 2 4 3 5]
 Output y is [1 2 3]
 Input  x = [5 9 3 2 2 0 -1]
 Output y is [5 3 2 -1]

Solution Stats

54.1% Correct | 45.9% Incorrect
Last solution submitted on Apr 22, 2018

Problem Comments

Solution Comments

Recent Solvers12457

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more