slow down the for loop operation for huge set of datas

조회 수: 4 (최근 30일)
SatyaPrakash Gupta
SatyaPrakash Gupta 2020년 4월 2일
댓글: darova 2020년 4월 3일
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
SatyaPrakash Gupta
SatyaPrakash Gupta 2020년 4월 3일
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 2020년 4월 3일
You have there some military data or what?

댓글을 달려면 로그인하십시오.

답변 (1개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by