Borrar filtros
Borrar filtros

Call Matlab distance metrics with function

1 visualización (últimos 30 días)
Tom
Tom el 5 de Ag. de 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')

Respuestas (1)

Jan
Jan el 5 de Ag. de 2013
Editada: Jan el 6 de Ag. de 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')

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by