Make the vector lin=[1 2 3 ⋯ 20] (the integers from 1 to 20), and then make every other value in it negative to get lin=[1 −2 3 −4 ⋯ −20] . what is the MATLAB code?

 Respuesta aceptada

lin(2:2:end)=-lin(2:2:end)

1 comentario

Having looked through google for the answer to the question stated above, I was very delighted to find your answer. Thank you.

Iniciar sesión para comentar.

Preguntada:

el 11 de Jul. de 2015

Comentada:

el 27 de Feb. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by