How to divide an area having multiple random points and work on each part separately?

I have asked this question before but couldnt get a satisfactory answer, so let me explain it a bit more, maybe i can make myself more clear.
I have scattered 100 points randomly in a 100x100 plot and divided that area into 9 grids.
a=rand(2,100)*100;
scatter(a(1,:),a(2,:))
grid on
set(gca,'xtick',[0:33.33333:100])
set(gca,'ytick',[0:33.33333:100])
Now I want to get some idea that how can I make groups for each grid (having points within) so that I can work on each grid separately.
Any help will be appreciated, thanks a lot!

댓글 수: 4

You should rather continue with the old thread with your explantions. Duplicating a question is not a good idea.
There was no response on my comment, and this thread is a kind of explanation of that one.
What exactly does "make groups" mean?
@ Jan, if we have random points scattered in a plot, then i want to find which grid have which points. The group means the group of points belong to a grid. For example
Grid1=[p1, p3, p4]
Grid2=[p6, p7, p8, p9] .... and so on

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

 채택된 답변

Jan
Jan 2017년 5월 10일
편집: Jan 2017년 5월 10일
Perhaps something like this simple loops:
a = rand(2,100)*100;
grid = 0:33.33333:100;
Result = cell(numel(grid) - 1, numel(grid) - 1);
for i1 = 1:numel(grid) - 1
for i2 = 1:numel(grid) - 1
index = (grid(i1) <= a(1, :) & a(1, :) < grid(i1 + 1) & ...
grid(i2) <= a(2, :) & a(2, :) < grid(i2 + 1));
Result{i1, i2} = a(index);
end
end
[EDITED] Now the points in the grid element [i,j] are store in the cell Result{i,j}.

댓글 수: 3

@Jan thank you for your kind responses, the main thing i am asking for is to separate each grid along with its point, so that i can work on each of them by calling there names. Like grid1 which has [.....] points, grid2 which has[.....] points, as i have mentioned in answer of your previous comment.
@Jan thanks a lot, can we see the result on a plot?

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

추가 답변 (1개)

Image Analyst
Image Analyst 2017년 5월 10일
Use max, min, and linspace.

댓글 수: 4

Can you please explain it little more
@asim: Accepting an answer means, that it has solved your problem.
mr.image analyst i sent you a comment in this link : https://www.mathworks.com/matlabcentral/answers/177316-how-to-show-my-extracted-features#comment_451853
plz can you see it

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

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2017년 5월 10일

댓글:

2017년 5월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by