Check if different points are contained in boundary of an xyz file.
2 次查看(过去 30 天)
显示 更早的评论
I have an xyz file that defines a coastal bathymetry. The xyz file consists only of negative numbers representing water depths. It was originally sampled (almost) regularly, so that it almost fits on a regular grid. However, I don't have that semi-grid file. There are also holes or rather islands in the shape defined. Now I want to check if a given point lies within this bathymetry, or if it is outside the boundary or on an 'island'. The point does not come from the xyz file, but may lie between those points in the file. Just a yes or no as to wether it is in. I can't do a contour because many boundary points have different depth values. Can anyone help me with a way to essentially 'color' the area where I have data, and then see if a given (x,y) point would be in that colored area? Plotting it to check is easy, but there are millions of points to handle. Thanks for any suggestions.
0 个评论
回答(1 个)
Chad Greene
2016-4-26
编辑:Chad Greene
2016-4-26
You can use xyz2grid to get the xyz data into a gridded format, then use inpolygon with a land area outline to determine which points are inside or outside the land area. The inpolygon function does not require a gridded dataset, but if your interest is in plotting the bathymetry with pcolor, surf, imagesc, or contour, you'll need the data in a complete grid.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Oceanography and Hydrology 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!