I have 2 huge matrices, A and B, with the same size (9000 by 9000). I need to search two numbers x and y from A and B, respectively, and return the indices where x and y appears in A and B. I have 10,000+ pairs of x and y saved in a table of C, therefore need to do 10,000+ such searches.
I am currently using the following code, but it took me 4+ hours to finish the searching.
linearIdx=rowfun(@(x, y)find(A==x & B == y),C ) ;[I,J]=ind2sub(size(A), linearIdx.Var1);
Is there faster way to do it? Maybe I should save A and B into hashtable? Thanks.
Best Answer