<< moc_islogical Matlab/Octave Compatibility toolbox moc_null >>

Matlab/Octave Compatibility toolbox >> Matlab/Octave Compatibility toolbox > moc_ismember

moc_ismember

Checks which elements of one matrix are member of an other matrix

Calling Sequence

tf = moc_ismember (A, S)
[tf,S_idx] = moc_ismember (A, S)
[tf,S_idx] = moc_ismember (A, S,'rows')

Description

Return a matrix tf with the same shape as A which has a 1 if A(i,j) is in S and 0 if it is not. If a second output argument is requested, the index into S of each of the matching elements is also returned.

With the optional third argument "rows", and matrices A and S with the same number of columns, compare rows in A with the rows in S.

Examples

a = [3, 10, 1];
s = [0:9];
[tf, s_idx] = moc_ismember (a, s)

a = [1:3; 5:7; 4:6];
s = [0:2; 1:3; 2:4; 3:5; 4:6];
[tf, s_idx] = moc_ismember(a, s, 'rows')

Authors


Report an issue
<< moc_islogical Matlab/Octave Compatibility toolbox moc_null >>