How can I find nearest value in large grid data?

조회 수: 3 (최근 30일)
Zubair Nizamani
Zubair Nizamani 2016년 7월 13일
댓글: Chad Greene 2016년 7월 14일
I have a grid having cells 100x60, containing contours data. Some of the cells have filled with whole number from 1 to 15 showing the elevation of contours, now how can I interpolate points between the contours line to fill all empty cells?
Note: Points are not in regular way, these scattered points

답변 (2개)

Walter Roberson
Walter Roberson 2016년 7월 13일
See John D'Errico's File Exchange contribution "inpaint_nan"
  댓글 수: 2
Zubair Nizamani
Zubair Nizamani 2016년 7월 13일
Dear Roberson thank you for your response and guideline. The function you have mentioned above is right now harder for me to understand because I am getting started with MATlab, So can you direct me any simplest way possible?
Chad Greene
Chad Greene 2016년 7월 14일
If you download inpaint_nans, it makes the problem pretty easy. For example, say you have some gridded dataset like this:
Z = peaks(100);
but a few points are NaNs:
Z([423 898 1234] = NaN;
You can fill in the missing values like this:
Z_filled = inpaint_nans(Z);

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


Image Analyst
Image Analyst 2016년 7월 13일
How about scatteredInterpolant()?
  댓글 수: 5
Image Analyst
Image Analyst 2016년 7월 13일
I need to leave now, but my first attempt would be to use scatteredInterpolant, like I already suggested. But I'm sure you've tried that by now, so let's see your code - it may speed me up when I return later today. If you didn't try my suggestion, then why not?
Walter Roberson
Walter Roberson 2016년 7월 13일
YourData(YourData == 0) = nan;
Now call the File Exchange contribution inpaint_nan on YourData.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by