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

3 ビュー (過去 30 日間)
HAAAAH
HAAAAH 2019 年 1 月 28 日
回答済み: Adam 2019 年 1 月 28 日
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 Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by