Find lower query points compared to the Reference vector
Ältere Kommentare anzeigen
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 Kommentare
Ganesh Naik
am 7 Aug. 2022
Voss
am 7 Aug. 2022
Just change the definition of idx(ii):
idx(ii) = find(Beg_In_Ex >= Beg_Data(ii),1);
Ganesh Naik
am 8 Aug. 2022
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Neighborhood and Block Processing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!