How can I use the inpolygon function for 3 dimensions?
조회 수: 19 (최근 30일)
이전 댓글 표시
I have plotted the chlorophyll monthly climatology of a specific region of a world map. I want to place a polygon on a specific region and plot time series for just that region. The chlorophyll data is in 3 dimensions of longitude, latitude, and dates (109x97x280). I'm confused on how to use the inpolygon function for 3 dimensions. I want to be able to make the polygon, determine which points are within that polygon, then average those points for each date to ultimately plot a time series. Any suggestions are helpful, thank you!
댓글 수: 2
채택된 답변
KSSV
2021년 6월 28일
You need not to use a 3D inpolygon. You are supposed to use inpolygon only once. Get your closed polygon coordinates(xv,yv); let X, Y be your grid coordinates.
idx = inpolygon(X,Y,xv,yv) ;
You got the indices, the same indices can be used for all the time steps.
댓글 수: 5
Walter Roberson
2021년 6월 28일
편집: Walter Roberson
2021년 6월 28일
Your xv and yv are 2d but do not have the same number of columns.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Map Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!