필터 지우기
필터 지우기

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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by