Invalid Distance argument, must be a character string (kDtreeSearcher)
2 views (last 30 days)
Show older comments
I am working on 3D points cloud with Matlab, and I want to compute the minimum distance of each point on an object X to all points on an other object Y.
To achieve this, I have constructed a kDtree for X and defined my own distance function Dist6D.m. Then using the knnsearch algorithm, I do this:
[match mindist] = knnsearch(kdOBJ,transpose(Y),'Distance',@Dist6D);
The problem I encounter is that it redirects me to the file
toolbox/stats/stats/KDTreeSearcher/knnsearch
and I can't define my own function. The only permitted functions are defined as strings and it doesn't allow me to use my own. in the description they wrote this :
% 'Distance' A string specifying the distance metric. The value can
% be one of the following:
% 'euclidean' - Euclidean distance
% 'cityblock' - City Block distance
% 'chebychev' - Chebychev distance (maximum
% coordinate difference)
% 'minkowski' - Minkowski distance
% Default is NS.Distance end
Lastly, I am obliged to use a kDtreeObject (Because using just X and Y without transforming one oh them to a Kdtree Obj solves the problem for me).
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!