How to find the indices of the closest value in two non-equal sized matrices?

1 回表示 (過去 30 日間)
Ali Almakhmari
Ali Almakhmari 2022 年 6 月 11 日
回答済み: KSSV 2022 年 6 月 11 日
I have two matrices with random numbers. One is 768 by 1024 (matrix A) and the other is 1536 by 2048 (matrix B). I want to develope a for loop code of some sort that is able to loop over all the numbers in those matrices and tell me what are the indices in matrix B that corresponds to the closest value in matrix A, and does this for ALL the numbers. I attempted this and failled, I hope someone can help. Thanks in advance.
Note: I uploaded an example of the two matrices that I was given.

回答 (1 件)

KSSV
KSSV 2022 年 6 月 11 日
Read about knnsearch

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by