How to compare rows in same matrix
이전 댓글 표시
Hello, I'am trying to solve what seems a simple problem. Looked around and there's plenty of suggestions but just can't manage to get it right. Here's the problem, I have a matrix of coordinates x and y, in which the data is given by the user. So I need a way of comparing rows to tell the user if two points have same coordinates.
cord=[0,0;
1,0;
2,0;
0,0;
1,0.75;
2,0.75]
So in this matrix row 1 and row 4 are the same so I would need any way of saying if this happens any number of times show error.
댓글 수: 1
per isakson
2014년 11월 13일
편집: per isakson
2014년 11월 14일
Did you try   [C,ia,ic] = unique(A,'rows')   followed by   histc(ia) ?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!