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!