Info

This question is closed. Reopen it to edit or answer.

how to make the make the 1st matrix 1st column as reference to the 2nd matrix

1 view (last 30 days)
hi,
I would like to know how to place a column in the matrix base on the reference matrix
Example
A = [1 -57 28 B = [-57 28
10 21 45 21 45
5 -36 52 -36 52
3 46 79 46 79
8 74 6 74 6
12 -38 35 -38 35
4 8 111 8 111
7 34 129 34 129
11 37 155 37 155
2 54 -65 *10 94*
9 -6 -41 54 -65
6 -22 -76] *10 94*
-6 -41
-22 -76]
from the matrices above, A is the reference matrix. How can I place the 1st column of matrix A to the matrix B as 1st column but, the value in the current matrix B column 1 and 2 must be same with the matrix A column 2 and 3. As can see there is some value in the matrix B column 2 and 3 that did not have the same value as in the matrix A, thus the 1st column for that row can be replace with anything that could differentiate with the other row . The answer should look like below.
C = [1 -57 28
10 21 45
5 -36 52
3 46 79
8 74 6
12 -38 35
4 8 111
7 34 129
11 37 155
zz *10 94*
2 54 -65
zz *10 94*
9 -6 -41
6 -22 -76]
thank you.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!