Extracting elements of a matrix based on latitude & longitude limits
이전 댓글 표시
I'm using the following code to extract elements of matrix z (180*360) which are within the boundary enclosed by xq & yq (limits of lat & lon). It returns only a 1*4 array which is not the desired output. Could you please help in improving this. (xvertices & yvertices are based on the latitude (180*1) & longitude (360*1) matrices) -Thank you-
A=ncread('GRD-3-2002094-2002120-GRAC_JPLEM_BA01_0600_LND_v04.nc','lwe_thickness');
A=A';
z=A(:,:);
xq=[110,160,160,110];
yq=[-10,-10,-40,-40];
xvertices=[0.5,359.5,359.5,0.5];
yvertices=[-89.5,-89.5,89.5,89.5];
data=inpolygon(xq,yq,xvertices,yvertices);
data_z=z(data)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Geoscience에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!