Remove duplicate sets of coordinates

조회 수: 20 (최근 30일)
Chris2fr
Chris2fr 2018년 4월 16일
답변: KSSV 2018년 4월 16일
I have an array of x,y,z coordinates and need to remove any duplicate points. I have tried the unique command but I just remove all duplicate x's or y's or z's, rather than the points where all three are duplicated.
I have tried to give an example of my code below with an 'ideal' output.
x= [1; 2; 2; 4; 4; 4; 1; 1]
y= [0; 0; 0; 3; 3; 3; 0; 0]
z= [5; 1; 1; 1; 3; 3; 1; 5]
Input= [x; y; z]
Desiredoutput= [...
1 0 5
2 0 1
4 3 1
4 3 3
1 0 1]

채택된 답변

KSSV
KSSV 2018년 4월 16일
Input= [x y z] ;
iwant = unique(Input,'rows') 

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by