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!