Count number of points within each cell using scatteredInterpolant
3 次查看(过去 30 天)
显示 更早的评论
Hello
I have an mx3 array of points in XYZ format. I'm using scatteredInterpolant in order to convert these points into a 2D array (image). I first use meshgrid to create a rectangular grid of X and Y values, e.g.:
[XGrid,YGrid] = meshgrid(x,y); % x and y are linearly spaced vectors based on the desired cell size, created using the raw xyz data
F = scatteredInterpolant(x_raw,y_raw,z_raw,'natural');
ZGrid = F(XGrid,YGrid);
For my work it would be very useful to find the number of points from the raw data which fall into each element (pixel) of the resulting image (2D array). In the above code, x and y are linearly spaced vectors obtained from irregularly spaced raw data (x_raw,y_raw,z_raw).
Any help would be greatly appreciated,
Jack Williams
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 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!