Using linspace outside of field data areas?

3 views (last 30 days)
I have data like this one (data: irregular in xyz, no data in the white area):
and would like to resample it using linspace. How can I force linspace to do this within the data range and set outside values to NaN? Otherwise the result will be like this one:
Thanks a lot for each hint,
Harald

Accepted Answer

Walter Roberson
Walter Roberson on 28 Jul 2021
Use scatteredInterpolant() with the Extrapolation Method set to 'none'
  8 Comments
Harald von der Osten
Harald von der Osten on 2 Aug 2021
yes, I can confirm that the data used are scattered. Here is a small sample:
583672.2,5417531.46,0,3.158504376141652,2,0,0,0.1
583672.6800000001,5417531.32,0,5.40855022159389,2,0,1,0.1
583673.16,5417531.19,0,5.839143662601507,2,0,2,0.1
583673.64,5417531.05,0,4.55544778040343,2,0,3,0.1
583674.13,5417530.92,0,6.341357944431953,2,0,4,0.1
583674.61,5417530.79,0,5.714415007217156,2,0,5,0.1
583675.09,5417530.65,0,3.359512393820803,2,0,6,0.1
583675.5699999999,5417530.52,0,2.854370950622065,2,0,7,0.1
583676.05,5417530.38,0,0.8373368253752029,2,0,8,0.1
583676.53,5417530.25,0,0.4138810632575255,2,0,9,0.1
583672.23,5417531.55,0,2.911780594093502,2,0,0,0.2
583672.71,5417531.42,0,4.778725366540664,2,0,1,0.2
583673.1899999999,5417531.29,0,5.314470696520858,2,0,2,0.2
583673.67,5417531.15,0,5.562580691332191,2,0,3,0.2
583674.15,5417531.02,0,6.09445558454945,2,0,4,0.2
583674.63,5417530.88,0,5.189610485588558,2,0,5,0.2
583675.12,5417530.75,0,3.382544976731074,2,0,6,0.2
583675.6,5417530.61,0,2.725916915564379,2,0,7,0.2
583676.08,5417530.48,0,1.22253892156351,2,0,8,0.2
583676.5600000001,5417530.34,0,0.598961386329446,2,0,9,0.2
583672.25,5417531.65,0,3.125056812045332,0,0,0,0.3
583672.73,5417531.52,0,4.950900511487444,0,0,1,0.3
583673.22,5417531.38,0,5.317797730440216,0,0,2,0.3
583673.7,5417531.25,0,6.680713602260954,0,0,3,0.3
583674.1800000001,5417531.11,0,6.068553224666836,0,0,4,0.3
583674.66,5417530.98,0,4.333805963959941,0,0,5,0.3
Yes, I want to interpolate only within connected regions, the white regions should be ignored, white gaps should not be filled. The small white areas around black dots are important (part of the geomagnetic anomalies) and should be not ignored.

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!