How to find out the column number of a same element of one matrix in other matrix?
1 回表示 (過去 30 日間)
古いコメントを表示
If I have two different matrices, having some same element i.e. A=[23 45 6 7 89 12 3 6 7 8] and B=[6 7 45 12]. Now, in A and B some elements are same like 45, 6, 7 and 12. Now, I want to know/assign the column number of theses same elements (45, 6, 7 and 12) in A matrix. That means The column of each element of B in A matrix. Where the same elements are positioned (i.e. column) in matix A?
0 件のコメント
回答 (2 件)
Walter Roberson
2019 年 1 月 17 日
[present, idx] = ismember(B, A);
present will be false for any element of B that is not in A. Otherwise B(K) == A(idx(K)) -- so idx is the entry number within A.
3 件のコメント
参考
カテゴリ
Help Center および File Exchange で Denoising and Compression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!