필터 지우기
필터 지우기

Visualizing Dense Areas in cartesian plane

조회 수: 2 (최근 30일)
Devinya Herath
Devinya Herath 2011년 10월 16일
I have a table that contains x, y coordinates (cartesian)of a large number of points. X coordinates are stored in a column called sp_x and corresponding y coordinates are stored in the column named 'sp_y'.
I download these data to matlab (please see the following coding) and assign x, y values to a matrix called xy. Now I want to see the dense areas (areas where the point density is high). Does anybody know a way to do this? pls help.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
curs1 = exec(conn, 'select sp_x, sp_y from road_part6_trajectories_oneway2_new_segments_cartesian2');
format long;
curs1 = fetch(curs1);
r=rows(curs1);
AA = curs1.Data;
x = [AA{:,1}]';
y = [AA{:,2}]';
for i=1:5
xy(i,1)=x(i);
xy(i,2)=y(i);
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

채택된 답변

Walter Roberson
Walter Roberson 2011년 10월 16일
xpnts = 100; %set as desired
ypnts = 100; %set as desired
minx = min(x);
miny = min(y);
scalex = xpnts ./ (max(x) - minx);
scaley = ypnts ./ (max(y) - miny);
scaledx = 1 + floor(x-minx) * scalex;
scaledy = 1 + floor(y-miny) * scaley;
densemap = accumarray([scaledx(:),scaledy(:)],1);
imagesc(densemap);
You might also find this File Exchange contribution to be useful.
  댓글 수: 4
Devinya Herath
Devinya Herath 2011년 10월 18일
Again, I get the following error. In my program xpnts=576078 and ypnts=576078 Is this the cause? If so what is the solution for that. Pls help.
??? Error using ==> accumarray
Maximum variable size allowed by the program is exceeded.
Error in ==> temp12 at 28
densemap = accumarray([scaledx(:),scaledy(:)],1);
Devinya Herath
Devinya Herath 2011년 10월 19일
Yes. The program does work if xpnts and ypnts are smaller than 9000. If they are larger, I get the above error.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by