フィルターのクリア

Call Matlab distance metrics with function

1 回表示 (過去 30 日間)
Tom
Tom 2013 年 8 月 5 日
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')

回答 (1 件)

Jan
Jan 2013 年 8 月 5 日
編集済み: Jan 2013 年 8 月 6 日
function out = my_function(input_1, input_2, typeOfNorm)
...
out = pdist(X, typeOfNorm);
Now call your function like:
out = my_function(data1, data2, 'euclidian')

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by