MATLAB Answers

Matrix Indexing and manipulations

4 views (last 30 days)
Abel Francis
Abel Francis on 14 Jun 2020
Commented: Matt J on 17 Jun 2020
I have 4 points with point ID A, B, C & D which is a 4 by 3 matrix (A_matrix), I want to manipulate it such that the resultant B_matrix is 6 by 6 matrix. Note, the B-matrix most follow the definition of point ID " From To " to enable further applications. Can somebody assist me, please.
A_Matrix
x y z
A 593898.8877 -4856214.546 4078710.706
B 594576.9223 -4855007.836 4080036.446
C 593997.0267 -4854862.499 4080291.279
D 593319.2704 -4855416.031 4079738.306
B_Matrix
From To X Y Z X Y Z
A B 593898.8877 -4856214.546 4078711 594576.9 -4855008 4080036
B C 594576.9223 -4855007.836 4080036 593997 -4854862 4080291
A C 593898.8877 -4856214.546 4078711 593997 -4854862 4080291
D C 593319.2704 -4855416.031 4079738 593997 -4854862 4080291
A C 593898.8877 -4856214.546 4078711 593997 -4854862 4080291
B D 594576.9223 -4855007.836 4080036 593319.3 -4855416 4079738

  0 Comments

Sign in to comment.

Accepted Answer

Matt J
Matt J on 15 Jun 2020
[A_matrix([1 2 1 4 1 2],:) , A_matrix([2 3 3 3 3 4],:)]

  6 Comments

Show 3 older comments
Matt J
Matt J on 15 Jun 2020
The pair {A C} should appear only once.
But in your original post it appears twice.
There are also pairs that do not appear in your 4x3 example, like From=B, To=A. How do you decide which pairs do not appear?
Abel Francis
Abel Francis on 17 Jun 2020
Hi Mr. Matt J. Am sorry for not given you clear direction as to the composition of the baseline component definition, " From To ". After careful study, I got to know that the pair {A C} or any other combination can appear once or more depending on the direction of pair sought. In fact pairing patterrn is determine by the layout of points. So there is no fix pattern for " From To ". The pupose of the paring is to enable me subsract " From" from " To ", that is, 'C- A', 'E- A', etc. to get vectors dX, dY & dZ. The data format below which contains new dataset is important because there are other functions that make use of it. My concern is that I have a large dataset consisting of 32 points with about 171 baselines to handle. So generalizing the process is neccessary. Thank you for your consideration.
A 402.35087 -4652995.30109 4349760.77753
B 8086.03178 -4642712.84739 4360439.08326
C 12046.58080 -4649394.08240 4353160.06450
D -3081.58310 -4643107.36920 4359531.12340
E -4919.33880 -4649361.21990 4352934.45480
F 1518.80120 -4648399.14540 4354116.691
A C
A E
B C
B D
D C
D E
F A
F C
F E
F D
F B
B F
A F
A B
Matt J
Matt J on 17 Jun 2020
You're quite welcome.

Sign in to comment.

More Answers (0)

Products


Release

R2013a

Translated by