Call Matlab distance metrics with function

1 vue (au cours des 30 derniers jours)
Tom
Tom le 5 Août 2013
Hi,
I'm writing a function in which I call the built in Matlab function 'pdist'. Can I somehow have the user specify which distance to use in my function?
Something like the following:
function out = my_function(input_1, input_2, 'euclidian')
...
out = pdist(X, 'euclidian')

Réponses (1)

Jan
Jan le 5 Août 2013
Modifié(e) : Jan le 6 Août 2013
function out = my_function(input_1, input_2, typeOfNorm)
...
out = pdist(X, typeOfNorm);
Now call your function like:
out = my_function(data1, data2, 'euclidian')

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by