How would you compare a 1x6 matrix to individual rows of a 10100x6 matrix. I want to know how to compare this 1x6 matrix to each of the rows of the larger matrix one at a time and then count the number of times that they are equivalent.
How would you compare a 1x6 matrix to individual rows of a 10100x6 matrix. I want to know how to compare this 1x6 matrix to each of the rows of the larger matrix one at a time and then count the number of times that they are equivalent.
Try this:
Results in:Code:A = reshape(1:60,6,10)' %matrix containing data b = 1:6% row to compare c = sum(all(A == repmat(b,size(A,1),1),2))%number of time row occurs
Regards ElbartoCode:A = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 b = 1 2 3 4 5 6 c = 1