Hello; Given a vector B = [ 8 3 9 4 6 7 7 5 4 5]; How do I call out from B all the even element locations? (Not even numbers, locations)

Hello; Given a vector B = [ 8 3 9 4 6 7 7 5 4 5]; How do I call out from B all the even element locations? (Not even numbers, locations)

 Respuesta aceptada

% B(2:2:end) % NO
EDIT:
find(mod(B,2)==0)

3 comentarios

isn't this suppose to be 1 4 5 9? I mean the locations of even element(8,4,6,4)?
Sorry ... I misread your intent. Answer edited.
i think your first answer is correct!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

el 4 de Mzo. de 2015

Comentada:

el 4 de Mzo. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by