Find the rows in matrix B that contain the two numbers in each row of matrix A, in every possible order
이전 댓글 표시
I have a Nx2-matrix A, and a Mx3-matrix B, with M>N. I would like to find the rows in B that contain the two numbers in each row of matrix A, in every possible order.
Example:
A = [1 2,
2 5]
B = [1 5 6,
1 4 2,
2 9 3,
9 5 2]
Then, for the first row in A, the second row in B should be selected, and for the second row in A, the fourth one should be selected. Thus, the result should be:
C = [1 4 2,
9 5 2]
I have already solved it with for loops, find and ismember, but my matrices are quite big and it is a quite time consuming solution. Can you please help me?
댓글 수: 1
Geoff Hayes
2015년 4월 11일
Paula - please provide a sample of the code that you are using to determine the matrix C so that we can offer alternative suggestions. And also clarify what you mean by your matrices are quite big. What is the smallest and what is the largest matrix that you are concerned with?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!