How can i count the number of point in each grid?
5 ビュー (過去 30 日間)
古いコメントを表示
I have a randomly generated scatter of 5000 points and I have laid a ring grid over the scatter plot.
Could somebody help me in calculating the number of points in the grid.
I did try to use histcounts2 but that was not giving me the correct answer.
Attached is a sample image in which I am trying to find the number of points in each grid.
0 件のコメント
回答 (1 件)
KSSV
2021 年 1 月 21 日
Get each box coordinates, this box is a polygon and then use the function inpolygon. Run a loop for each box.
2 件のコメント
KSSV
2021 年 1 月 22 日
Won't you think if you know whether points are inside the polygon, you can count the points? Inpolygon gives you the indices of points lying inside the polygon you can count the indices and the count says how many points are they.
参考
カテゴリ
Help Center および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!