Vector and Matrices comparison

1 回表示 (過去 30 日間)
Ali Ali
Ali Ali 2018 年 5 月 2 日
回答済み: Star Strider 2018 年 5 月 2 日
Hi,
I want to find the closest column to a vector and name the index of the column?
V =
0.320373395974224
0.343657408330863
0.0647635831054113
0.611246744787932
0.252543893010251
0.836651172399228
0.433132105815962
0.267252371218910
N =
0.843193555110595 0.0264000151356882 0.843929139772920 0.992086798255982
0.395105201566654 1.05039660938666 -0.0923156103168576 -0.000828850484347887
0.833340055022349 1.21116338190365 0.435817502517243 0.0928679524432253
0.721942976971473 0.0229586112613379 1.02469878021803 0.985841211841693
0.532957436613246 -0.0103493752471847 0.627547000618107 1.07676510721568
0.815457856716130 0.940451590084812 0.462335032896403 -0.0772672497132867
0.812823496795477 1.13990527774124 0.651114276529232 -0.00236099683556623
-0.00952043153750615 0.0382778981334200 -0.146625708734782 0.978428808245543
  2 件のコメント
Guillaume
Guillaume 2018 年 5 月 2 日
What is your definition of closest?
Ali Ali
Ali Ali 2018 年 5 月 2 日
nearest column values to the vector

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2018 年 5 月 2 日
Use the pdist2 (link) function.
Example
D = pdist2(V', N', 'euclidean','Smallest',1)
[~,ClosestCol] = min(D)
Note the transposition operators (').

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by