Find lower query points compared to the Reference vector
古いコメントを表示
Hi all, I have two vectors, one is "Beg_Data" which has 19 values and I have another reference vector "Beg_In_Ex" which contains 1239 values (Data attached). I am computing a new vector "End_Cycle" same size (19 values) that of "Beg_Data" vector based on the nearest neighbour search. I would like to achieve the results of "End_Cycle" values lower than that of corresponding values that of "Beg_Data". However, using the method that I have attempted I found some values are always higher than that of the "Beg_Data" values. As you can see I want the difference to be always positive (End_Cycle<Beg_Data). Any help in this regard is highly appreciated.
load data.mat;
End_Cycle = dsearchn(Beg_In_Ex',Beg_Data);
End_Cycle = Beg_In_Ex(End_Cycle)';
Start_Stop = [End_Cycle Beg_Data]
Difference = Start_Stop(:,2)-Start_Stop(:,1)
3 件のコメント
Ganesh Naik
2022 年 8 月 7 日
Voss
2022 年 8 月 7 日
Just change the definition of idx(ii):
idx(ii) = find(Beg_In_Ex >= Beg_Data(ii),1);
Ganesh Naik
2022 年 8 月 8 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Neighborhood and Block Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!