Divide a specific element in a matrix

1 次查看(过去 30 天)
For example I have:
A=[1 2 3; 3 2 4; 5 4 1]
And I want it like this:
A=[1 -2 -3; -3 2 -4; -5 -4 1]
As you can see i'm trying to divide A12 A13 A21 A23 A31 A32 by -1, how can I do it?
Thank you
  2 个评论
James Tursa
James Tursa 2019-5-8
From your description, wouldn't the result be this instead?
A = [1 -2 -3; -3 2 -4; -5 -4 1]
If not, then what is the rule?

请先登录,再进行评论。

采纳的回答

Fangjun Jiang
Fangjun Jiang 2019-5-8
A.*(2*eye(3)-1)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by