Let D
be n
by 2
matrix (data from text file).
Let M
by m
by 2
matrix (data from excel file).
The first stage is to find the relevant n-m
rows of D
: rows that their first value does not appear in M
, using setdiff
.
[~, idx] = setdiff( D( :, 1 ), M( :, 1 ), 'stable' );
Now we can compute the all-vs-all diff using bsxfun
d = bsxfun( @minus, permute( D( idx, : ), [1 3 2] ), ...
permute( D( idx, : ), [3 1 2] ) );
Now d
is |idx
|x|idx
|x2
array where
d( ii, jj, : ) = D( idx(ii), :) - D( idx(jj), : )