フィルターのクリア

How to get the neighbors points within the specific radius in the rangesearch?

3 ビュー (過去 30 日間)
amj
amj 2018 年 3 月 8 日
編集済み: amj 2018 年 3 月 9 日
Hi,
I found few articles discussed about the neighbors points within the specific radius using range search:
I tried with this simple code:
load fisheriris
rng(1); % For reproducibility
n = size(meas,1);
idx = randsample(n,3)
X = meas(~ismember(1:n,idx),3:4); % Training data
Y = meas(idx,3:4)
[idx, dist] = rangesearch(X,Y,1.5)
X(idx,:)
I got this such error:
Function 'subsindex' is not defined for values of class 'cell'.
So, means, i need to apply the cell function(maybe) to get the data points within 1.5 radius of Y.
Can anyone advice me on how to get the datapoints within 1.5 radius of Y?
I'm newbie in distance

採用された回答

Walter Roberson
Walter Roberson 2018 年 3 月 8 日
cellfun(@(IDX) X(IDX,:), idx, 'uniform', 0)
Each original point has a cell of points that are within range because the number of points within range might be different for each one. So you have to process each cell separately.
  1 件のコメント
amj
amj 2018 年 3 月 9 日
編集済み: amj 2018 年 3 月 9 日
Dear Walter, Thank you very much. Let me try

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by