|
"Diego Zegarra" wrote in message <gnpgtv$1hh$1@fred.mathworks.com>...
> Thanks Jos, it would work like this,
>
> tf = sum(ismember(A(:,1:3), [5 1 2], 'rows'))
For this purpose I posted a mfind matlab function that finds the matching rows or columns in a matrix
[ I B ] = mfind(M, X)
Find the row or column vector X within the matrix M.
If X is a row vector, I will contain the column indexes where X is a row in M.
If X is a column vector, I will contain the row indexes where X is a column in M.
B will contain the boolean matching rows or columns.
If no match if found, I will be empty.
Example:
a = [1 2; 3 4; 5 6];
[i b] = mfind(a, [3 4])
i = 2
b = [ 0; 1; 0 ]
[i b] = mfind(a, [1; 3; 5])
i = 1
b = [ 1 0 ]
The MFIND script may be downloaded here in MATALB central files exchange
|