How to change a sign of elements in a matrix for each coulmn separatly ?

3 次查看(过去 30 天)
I want to change
v = [-2 3 0.5 4 22 15 -19 -0.01 104 78]
to
vny = [-2 -3 0.5 -4 22 -15 -19 0.01 104 -78]
thanks for tips
  1 个评论
Adam
Adam 2019-1-28
编辑:Adam 2019-1-28
What is the logic behind which columns you want to change? Just every other column? If there is none then obviously you will have to do it manually (or at least create a multiplier array manually).

请先登录,再进行评论。

采纳的回答

Adam
Adam 2019-1-28
vny = v;
vny( 2:2:end) = -vny( 2:2:end);
should work

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by