how to crop a 3d data using lat , long and save the cropped file?

조회 수: 3 (최근 30일)
Sreeraj R
Sreeraj R 2021년 11월 22일
댓글: Image Analyst 2021년 11월 24일
hello everyone
i am trying to crop a 3d data and save the cropped data. i tried a simple code for cropping
RF6=RF(60:110,5:45,:);
but it gave me the error as
Index in position 1 exceeds array bounds (must not exceed 34).
how do i crop the data?

답변 (1개)

Image Analyst
Image Analyst 2021년 11월 22일
The array does not have 110 rows -- it has only 34. Are you sure you're indexing by RF(row, columns, slice) and not by RF(x, y, slice)? Because y is row, it comes first, like RF(y, x, slice). Otherwise just read to the end with
RF6 = RF(60 : end, 5 : end, :);
but it will have to have at least 60 rows and 5 columns.
  댓글 수: 8
Sreeraj R
Sreeraj R 2021년 11월 24일
in the longitude array in row 1 the value is -72.2852 in row 34 it is -72.2385. how do i crop my area from these values?
Image Analyst
Image Analyst 2021년 11월 24일
I'm not sure what that means. Crop what? You just have to know what row or column is what value. If it's linear you can find out what longitude is in each row by doing this:
coefficients = polyfit([1, 34], [-72.2852, -72.2385], 1);
longitudes = polyval(coefficients, 1:34);
Now longitudes(someRow) will give you a number around 72 for whatever index you specify for someRow. If that helps, maybe you can click the "Accept this answer" link.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by