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 で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!