Error while using pdist function

X=[1,1;2,2;3,3]
D = pdist(X,Distance)
#This command shows the following error:
Unrecognized function or variable 'Distance'.
Did you mean:
>> D = pdist(X,distance)
#If i try running with distance, the following error is displayed:
Error using distance
Not enough input arguments.
What is the correct way to use distance?

回答 (1 件)

KSSV
KSSV 2022 年 4 月 8 日
編集済み: KSSV 2022 年 4 月 8 日

1 投票

You cannot use whatever the word you want. There are specified words which are methods of getting the distance.
X=[1,1;2,2;3,3]
X = 3×2
1 1 2 2 3 3
D = pdist(X,'euclidean')
D = 1×3
1.4142 2.8284 1.4142

カテゴリ

ヘルプ センター および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

製品

リリース

R2022a

タグ

質問済み:

2022 年 4 月 8 日

編集済み:

2022 年 4 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by