Filter löschen
Filter löschen

Call Matlab distance metrics with function

1 Ansicht (letzte 30 Tage)
Tom
Tom am 5 Aug. 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')

Antworten (1)

Jan
Jan am 5 Aug. 2013
Bearbeitet: Jan am 6 Aug. 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')

Community Treasure Hunt

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

Start Hunting!

Translated by