Filter löschen
Filter löschen

selecitng lines of same intercept from two matrices

3 Ansichten (letzte 30 Tage)
salman abbasi
salman abbasi am 9 Nov. 2020
Kommentiert: salman abbasi am 9 Nov. 2020
Hi
I have two matrices. Each of these matrices have straigh lines. For example in matrix A, i have 6 stragith lines. All of these lines havean y intercetp, and all have same slope. In matric B, i have another set og 6 lines. They also have same slope, and intercept times.
I like to compare lines between matrix A and matrix B, and only select that line which has same y intercept.
so for example, in matrix A, y intercept of 6 lines i s, 1,2,3,4,5,6 and in matrix B, y intercept is 1.5,2,2.5,4,5.5,6. so i like to select lines fromeither matrix A or B which have common intercept, that i s, line 2,4,and 6.
I have added images of two matrices. In both of these matrices, line1, 3 and 5th have same intercept.
I need to get these lines and save in a new matrix. These lines do not have the sampel element values
thanks
sal
  4 Kommentare
Rik
Rik am 9 Nov. 2020
Again, I don't understand your description, but if you have this:
A_data=[1,2,3,4,5,6];
B_data=[1.5,2,2.5,4,5.5,6];
Then you can use ismember to extract [2,4,6].
salman abbasi
salman abbasi am 9 Nov. 2020
@Rik . Thanks Ri. Please see images of two matrices. The elements values do not match. I need to take out line 1,3 and 5 automaticaly. So the way i see it to compare two matrices, which is part of the algorithm i am writing, and comapre them based on Y-intercept

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by