MATLAB Answers

0

Divide a specific element in a matrix

Asked by Tran Thien on 8 May 2019
Latest activity Commented on by Tran Thien on 8 May 2019
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 Comments

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?
Yes it is, sorry i'll edit it :D

Sign in to comment.

Tags

Products

1 Answer

Answer by Fangjun Jiang on 8 May 2019
 Accepted Answer

A.*(2*eye(3)-1)

  1 Comment

Thank you ! I did it :D

Sign in to comment.