필터 지우기
필터 지우기

Add coordinate points to a grid

조회 수: 11 (최근 30일)
Vanessa
Vanessa 2015년 7월 25일
댓글: Vanessa 2015년 7월 26일
Hi, I need help. Im trying to create a grid (map of a ground) 200m x 300m and then I need to add some points in the grid. I have the coordinates of the points, but I dont know how to do it. I did the grid with the command [X,Y]= meshgrid() but it created a grid with lines, not an empty grid. So, I need an empty grid in which I can add the points. Thanks so much, Vanessa
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 7월 25일
Are you wanting to use the mapping toolbox?
Vanessa
Vanessa 2015년 7월 26일
I think is not necessary, just a grid in which I could add points (trees) and then evaluate how many of these points are around (e.g. radius of 5 meters) to a specific point.

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

채택된 답변

Image Analyst
Image Analyst 2015년 7월 26일
Why can't you just do
% Create empty grid. No lines at all, or any points at all.
myGrid = zeros(rows, columns);
% You say you have existing coordinates already.
% Let's assume they are in arrays called x and y
% and have values that correspond to rows and columns.
% Place them in the grid with a value of 1
for k = 1 : length(x)
myGrid(y(k), x(k)) = 1;
end
  댓글 수: 2
Image Analyst
Image Analyst 2015년 7월 26일
To find out which are within a distance of 5 from some other point (x0, y0):
distances = sqrt((x-x0).^2 + (y-y0).^2);
% Get a logical index array of those elements within 5
within5 = distances < 5;
% Now "evaluate how many of these points are around
% (e.g. radius of 5 meters) to a specific point."
howMany = sum(within5);
I think this should get you what you asked for.
Vanessa
Vanessa 2015년 7월 26일
Thanks so much :)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by