Calculate euclidean distance from every vector in matrix A to every in matrix B
wadzapi (2021). Euclidean distance (https://www.mathworks.com/matlabcentral/fileexchange/42064-euclidean-distance), MATLAB Central File Exchange. Retrieved .
John D'Errico's ipdm does this much better:
While Octave has "endfor", Matlab uses "end" for FOR loops.
BSXFUN ist faster than expanding the data by REPMAT.
SUM(Matrix, 2) replies a column vector, so I'd expect problems when you assign "dist_i" to a row of the result.
The missing pre-allocation slows down this function dramatically for larger inputs.
I think, this function cannot be used in its current state. Substantial changes in the code and a more detailed help section would be a a welcome improvement.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!