Subtract column values where leading columns have values flipped (i.e., (A,B,C1) – (B,A,C2))
Suppose I have a table, T:
A B C
1 6 10
2 5 20
3 4 30
4 3 45
5 2 6
6 1 10
I want to subtract each entry in column C where the A and B values are flipped, and put this value into column D
For example, the first row (1, 6, 10) – the last row (6, 1, 10); (2, 5, 20) – (5, 2, 6) and so on
So D should be:
0
14
-15
15
-14
0
Thanks a lot!
Edit: (i) Flipped rows could occur anywhere in the table; (ii) there may be repeated values in Α and BSuppose I have a table, T:
A B C
1 6 10
2 5 20
3 4 30
4 3 45
5 2 6
6 1 10
I want to subtract each entry in column C where the A and B values are flipped, and put this value into column D
For example, the first row (1, 6, 10) – the last row (6, 1, 10); (2, 5, 20) – (5, 2, 6) and so on
So D should be:
0
14
-15
15
-14
0
Thanks a lot!
Edit: (i) Flipped rows could occur anywhere in the table; (ii) there may be repeated values in Α and B Suppose I have a table, T:
A B C
1 6 10
2 5 20
3 4 30
4 3 45
5 2 6
6 1 10
I want to subtract each entry in column C where the A and B values are flipped, and put this value into column D
For example, the first row (1, 6, 10) – the last row (6, 1, 10); (2, 5, 20) – (5, 2, 6) and so on
So D should be:
0
14
-15
15
-14
0
Thanks a lot!
Edit: (i) Flipped rows could occur anywhere in the table; (ii) there may be repeated values in Α and B subtraction, tables values MATLAB Answers — New Questions