FInd vector in matrix
이전 댓글 표시
Lets assume that I have a matrix A 300x2 with x y coordinates. I want to find how many times a specific [x y] exists in this matrix A. I ve tried this but find can search only single values.
i = find(A == [x y]);
Any idea?????
댓글 수: 1
Azzi Abdelmalek
2014년 2월 19일
[Kris zenitis commented]
Yeah thank you man!!
채택된 답변
추가 답변 (1개)
Matt Fig
2011년 5월 14일
For example:
A = reshape(1:12,6,2) % A sample matrix for demonstration...
I = ismember(A,[4 10],'rows');
If you want to find how many there are, use:
S = sum(I)
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!