Comparing two vectors with different dimensions
8 ビュー (過去 30 日間)
古いコメントを表示
Hello,
How can you compare two vectors with different number of elements? I am just trying to find the equal elements. Thanks!
0 件のコメント
採用された回答
the cyclist
2012 年 6 月 14 日
Your question is fairly vague, but I have a feeling that either the ismember() command or the intersect() command will help you do what you want.
その他の回答 (1 件)
Rohan Kale
2012 年 6 月 19 日
Let a and b be two arrays(or vectors). L=length(a), M=length(b).Suppose L>M, pad_zero=L-M; now b=[b zeros(1,pad_zero)]; c=a-b; now you can find the indices of the zero elements excluding the last pad_zero elements. These are your desired indices. Hope it helps.
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!