%% Determine Set Members by Rows
% By default, ismembertol looks for elements that are within tolerance, but it also can find rows of a matrix that are within tolerance.
% Create a numeric matrix, A. Obtain a second matrix, B, by transforming and untransforming A. This transformation introduces round-off differences to B.

A = [0.05 0.11 0.18; 0.18 0.21 0.29; 0.34 0.36 0.41; ...
    0.46 0.52 0.76; 0.82 0.91 1.00];
B = log10(10.^A);

%
% Use ismember to find the rows of A that are in B. ismember performs exact comparisons and thus determines that most of the rows in A are not members of B, even though some of the rows differ by only a small amount.

lia = ismember(A,B,'rows')

%
% Use ismembertol to perform the row comparison using a small tolerance. ismembertol treats rows that are within tolerance as equal and thus determines that all of the rows in A are members of B.

LIA = ismembertol(A,B,'ByRows',true)

% Copyright 2015 The MathWorks, Inc.