performance - An efficient, optimized code for matching rows in a huge matrix -


i have huge matrix on need matching operation. here's code have written , works fine, think there room make more optimized or write code matching in less time. please me that?

rowsmatched = find(bigmatrix(:, 1) == matchingrow(1, 1)          & bigmatrix(:, 2) == matchingrow(1, 2)          & bigmatrix(:, 3) == matchingrow(1, 3)) 

the problem code cannot use && operand. so, in case 1 of columns not match, program still checks next condition. how can avoid this?

update: here's solution problem:

rowsmatched = find(all(bsxfun(@eq, bigmatrix, matchingrow),2)); 

thank you

you can use bsxfun in vectorized manner:

rowsmatched = find(all(bsxfun(@eq, bigmatrix, matchingrow),2)); 

notice work number of columns, matchingrow should have same number of columns bigmatrix.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -