Borrar filtros
Borrar filtros

slow down the for loop operation for huge set of datas

1 visualización (últimos 30 días)
SatyaPrakash Gupta
SatyaPrakash Gupta el 2 de Abr. de 2020
Comentada: darova el 3 de Abr. de 2020
Hello Team,
I would like to increase the search operation in quite faster way, the below code i have implemented takes atleast 40mins to complete it because i have very huge data
for i = 1:length(LocationsListData.x) % which is approximately 26532957
idx = inpolygon(X(:),Y(:),LocationsListData.x(i),LocationsListData.y(i)) ;% X and Y has 4196*4196 size for each element
idx(idx==0)=[];
if~isempty(idx)
value(i) = idx;
end
end
do you see any possiblities to reduce the speed ? if so and then how can i do that ?
  5 comentarios
SatyaPrakash Gupta
SatyaPrakash Gupta el 3 de Abr. de 2020
Hii Darova,
please find the locationListdata attaced in the below link.
there is no polygon available , i have grid where i use to search for available data in each grid using inpolygon function
darova
darova el 3 de Abr. de 2020
You have there some military data or what?

Iniciar sesión para comentar.

Respuestas (1)

Mohammad Sami
Mohammad Sami el 3 de Abr. de 2020
You don't need to use the for loop with the inpolygon function.
idx = inpolygon(X(:),Y(:),LocationsListData.x,LocationsListData.y);
  1 comentario
SatyaPrakash Gupta
SatyaPrakash Gupta el 3 de Abr. de 2020
this will also slow down and take much time.
anyway i dont need this logic anymore,thank you

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by