Skip to main content
added 673 characters in body
Source Link

I have something like this

tes1 = {{1, 2}, {0, 2}, {5, 10}}; tes2 = {{0, 2}, {5, 5}, {1, 2}}; Table[{If[tes1[[i]] == tes2[[j]], tes1[[i]], Null ]}, {j, 1, Length[tes1]}, {i, 1, Length[tes1]}] 

If I use Print[tes1[[i]]] instead of tes1[[i]] inside the "If", I got what I need, that is {0,2} and {1,2} only. But I want to convert in a list {{0,2},{1,2}}, how could I do that?

Edit1: In special, for the lists in https://pastebin.com/r4eCV5vT

If you compare them with Intersection, you will find that some points are not being compared. [![points][1]][1] [1]: https://i.sstatic.net/SFvzb.pngpoints The figure shows two red points, obtained from Intersection and you can see that there is two missed points (actually there is more points that both lists have in common), indicated with arrows.

Edit2: Doing

PtsDown = Table[SetAccuracy[Downn[[i, j]], 3], {i, 1, Length[Downn]}, {j, 1, 2}]; PtsUpp = Table[ SetAccuracy[Upp[[i, j]], 3], {i, 1, Length[Upp]}, {j, 1, 2}]; Table[{If[PtsDown[[i]] == PtsUpp[[j]], Print[PtsDown[[i]]],]}, {j, 1, Length[PtsUpp]}, {i, 1, Length[PtsDown]}] 

Gives

{0.*10^-3,8.66} {0.*10^-3,8.66} {4.50,2.60} {4.50,2.60} {7.50,9.53} {12.00,3.46} {12.00,3.46} {15.00,10.39} {15.00,10.39} 

The problem is that I need to copy the points without the repeated ones, after that, we got enter image description here

Or using the suggestion

 Select[PtsUpp, MemberQ[PtsDown, #] &] 

Gives

{{0.*10^-3, 8.66}, {0.*10^-3, 8.66}, {4.50, 2.60}, {7.50, 9.53}, {12.00, 3.46}, {12.00, 3.46}, {15.00, 10.39}} 

I have something like this

tes1 = {{1, 2}, {0, 2}, {5, 10}}; tes2 = {{0, 2}, {5, 5}, {1, 2}}; Table[{If[tes1[[i]] == tes2[[j]], tes1[[i]], Null ]}, {j, 1, Length[tes1]}, {i, 1, Length[tes1]}] 

If I use Print[tes1[[i]]] instead of tes1[[i]] inside the "If", I got what I need, that is {0,2} and {1,2} only. But I want to convert in a list {{0,2},{1,2}}, how could I do that?

Edit1: In special, for the lists in https://pastebin.com/r4eCV5vT

If you compare them with Intersection, you will find that some points are not being compared. [![points][1]][1] [1]: https://i.sstatic.net/SFvzb.png The figure shows two red points, obtained from Intersection and you can see that there is two missed points (actually there is more points that both lists have in common), indicated with arrows.

I have something like this

tes1 = {{1, 2}, {0, 2}, {5, 10}}; tes2 = {{0, 2}, {5, 5}, {1, 2}}; Table[{If[tes1[[i]] == tes2[[j]], tes1[[i]], Null ]}, {j, 1, Length[tes1]}, {i, 1, Length[tes1]}] 

If I use Print[tes1[[i]]] instead of tes1[[i]] inside the "If", I got what I need, that is {0,2} and {1,2} only. But I want to convert in a list {{0,2},{1,2}}, how could I do that?

Edit1: In special, for the lists in https://pastebin.com/r4eCV5vT

If you compare them with Intersection, you will find that some points are not being compared. points The figure shows two red points, obtained from Intersection and you can see that there is two missed points (actually there is more points that both lists have in common), indicated with arrows.

Edit2: Doing

PtsDown = Table[SetAccuracy[Downn[[i, j]], 3], {i, 1, Length[Downn]}, {j, 1, 2}]; PtsUpp = Table[ SetAccuracy[Upp[[i, j]], 3], {i, 1, Length[Upp]}, {j, 1, 2}]; Table[{If[PtsDown[[i]] == PtsUpp[[j]], Print[PtsDown[[i]]],]}, {j, 1, Length[PtsUpp]}, {i, 1, Length[PtsDown]}] 

Gives

{0.*10^-3,8.66} {0.*10^-3,8.66} {4.50,2.60} {4.50,2.60} {7.50,9.53} {12.00,3.46} {12.00,3.46} {15.00,10.39} {15.00,10.39} 

The problem is that I need to copy the points without the repeated ones, after that, we got enter image description here

Or using the suggestion

 Select[PtsUpp, MemberQ[PtsDown, #] &] 

Gives

{{0.*10^-3, 8.66}, {0.*10^-3, 8.66}, {4.50, 2.60}, {7.50, 9.53}, {12.00, 3.46}, {12.00, 3.46}, {15.00, 10.39}} 
added 63 characters in body
Source Link

I have something like this

tes1 = {{1, 2}, {0, 2}, {5, 10}}; tes2 = {{0, 2}, {5, 5}, {1, 2}}; Table[{If[tes1[[i]] == tes2[[j]], tes1[[i]], Null ]}, {j, 1, Length[tes1]}, {i, 1, Length[tes1]}] 

If I use Print[tes1[[i]]] instead of tes1[[i]] inside the "If", I got what I need, that is {0,2} and {1,2} only. But I want to convert in a list {{0,2},{1,2}}, how could I do that?

Edit1: In special, for the lists in https://pastebin.com/r4eCV5vT

If you compare them with Intersection, you will find that some points are not being compared. [![points][1]][1] [1]: https://i.sstatic.net/SFvzb.png The figure shows two red points, obtained from Intersection and you can see that there is two missed points (actually there is more points that both lists have in common), indicated with arrows.

I have something like this

tes1 = {{1, 2}, {0, 2}, {5, 10}}; tes2 = {{0, 2}, {5, 5}, {1, 2}}; Table[{If[tes1[[i]] == tes2[[j]], tes1[[i]], Null ]}, {j, 1, Length[tes1]}, {i, 1, Length[tes1]}] 

If I use Print[tes1[[i]]] instead of tes1[[i]] inside the "If", I got what I need, that is {0,2} and {1,2} only. But I want to convert in a list {{0,2},{1,2}}, how could I do that?

Edit1: In special, for the lists in https://pastebin.com/r4eCV5vT

If you compare them with Intersection, you will find that some points are not being compared. [![points][1]][1] [1]: https://i.sstatic.net/SFvzb.png The figure shows two red points, obtained from Intersection and you can see that there is two missed points, indicated with arrows.

I have something like this

tes1 = {{1, 2}, {0, 2}, {5, 10}}; tes2 = {{0, 2}, {5, 5}, {1, 2}}; Table[{If[tes1[[i]] == tes2[[j]], tes1[[i]], Null ]}, {j, 1, Length[tes1]}, {i, 1, Length[tes1]}] 

If I use Print[tes1[[i]]] instead of tes1[[i]] inside the "If", I got what I need, that is {0,2} and {1,2} only. But I want to convert in a list {{0,2},{1,2}}, how could I do that?

Edit1: In special, for the lists in https://pastebin.com/r4eCV5vT

If you compare them with Intersection, you will find that some points are not being compared. [![points][1]][1] [1]: https://i.sstatic.net/SFvzb.png The figure shows two red points, obtained from Intersection and you can see that there is two missed points (actually there is more points that both lists have in common), indicated with arrows.

added 367 characters in body
Source Link

I have something like this

tes1 = {{1, 2}, {0, 2}, {5, 10}}; tes2 = {{0, 2}, {5, 5}, {1, 2}}; Table[{If[tes1[[i]] == tes2[[j]], tes1[[i]], Null ]}, {j, 1, Length[tes1]}, {i, 1, Length[tes1]}] 

If I use Print[tes1[[i]]] instead of tes1[[i]] inside the "If", I got what I need, that is {0,2} and {1,2} only. But I want to convert in a list {{0,2},{1,2}}, how could I do that?

Edit1: In special, for the lists in https://pastebin.com/r4eCV5vT

If you compare them with Intersection, you will find that some points are not being compared. [![points][1]][1] [1]: https://i.sstatic.net/SFvzb.png The figure shows two red points, obtained from Intersection and you can see that there is two missed points, indicated with arrows.

I have something like this

tes1 = {{1, 2}, {0, 2}, {5, 10}}; tes2 = {{0, 2}, {5, 5}, {1, 2}}; Table[{If[tes1[[i]] == tes2[[j]], tes1[[i]], Null ]}, {j, 1, Length[tes1]}, {i, 1, Length[tes1]}] 

If I use Print[tes1[[i]]] instead of tes1[[i]] inside the "If", I got what I need, that is {0,2} and {1,2} only. But I want to convert in a list {{0,2},{1,2}}, how could I do that?

I have something like this

tes1 = {{1, 2}, {0, 2}, {5, 10}}; tes2 = {{0, 2}, {5, 5}, {1, 2}}; Table[{If[tes1[[i]] == tes2[[j]], tes1[[i]], Null ]}, {j, 1, Length[tes1]}, {i, 1, Length[tes1]}] 

If I use Print[tes1[[i]]] instead of tes1[[i]] inside the "If", I got what I need, that is {0,2} and {1,2} only. But I want to convert in a list {{0,2},{1,2}}, how could I do that?

Edit1: In special, for the lists in https://pastebin.com/r4eCV5vT

If you compare them with Intersection, you will find that some points are not being compared. [![points][1]][1] [1]: https://i.sstatic.net/SFvzb.png The figure shows two red points, obtained from Intersection and you can see that there is two missed points, indicated with arrows.

Source Link
Loading