<< nan_ifft utility functions nan_mgrp2idx >>

NaN Toolbox >> NaN Toolbox > utility functions > nan_ismember

nan_ismember

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

Calling Sequence

tf = nan_ismember (A, S)
[tf,S_idx] = nan_ismember (A, S)
[tf,S_idx] = nan_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] = nan_ismember (a, s);
tf = T F T
s_idx = 4, 0, 2.

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

Authors

<< nan_ifft utility functions nan_mgrp2idx >>