FUNCTION REFERENCE
pdist2
Distances between two observation sets.
Distances between two observation sets.
Syntax
[D,I] = pdist2(X,Y,metric,parameter,'Smallest',K)D normally has size rows(X)-by-rows(Y). Metrics and parameters are the same as pdist, with default scale/covariance estimated from X. 'Smallest',K or 'Largest',K returns K-by-rows(Y) distances and X row indices, in ascending or descending distance order. Equal distances use ascending indices. NaN distances sort last.
Example
[d,i] = pdist2([0;2;4],[1;3],'euclidean','Smallest',2); % i = [1 2;2 3]Differences from MATLAB: Brute force, bounded by the full pair-count cap even for selected results; no approximate or fast-distance variants.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.