Find lower query points compared to the Reference vector
Afficher commentaires plus anciens
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 commentaires
Ganesh Naik
le 7 Août 2022
Voss
le 7 Août 2022
Just change the definition of idx(ii):
idx(ii) = find(Beg_In_Ex >= Beg_Data(ii),1);
Ganesh Naik
le 8 Août 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Neighborhood and Block Processing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!