How can I find nearest value in large grid data?
Mostrar comentarios más antiguos
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
Respuestas (2)
Walter Roberson
el 13 de Jul. de 2016
0 votos
See John D'Errico's File Exchange contribution "inpaint_nan"
2 comentarios
Zubair Nizamani
el 13 de Jul. de 2016
Chad Greene
el 14 de Jul. de 2016
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
el 13 de Jul. de 2016
0 votos
How about scatteredInterpolant()?
5 comentarios
Zubair Nizamani
el 13 de Jul. de 2016
Editada: Walter Roberson
el 13 de Jul. de 2016
Image Analyst
el 13 de Jul. de 2016
You forgot to attach the workbook. For the benefit of everyone, attach the workbook AND a screenshot of your plot or image.
What kind of help do you need reading Excel? You obviously know about xlsread(). Do you want to know about ActiveX also?
Zubair Nizamani
el 13 de Jul. de 2016
Image Analyst
el 13 de Jul. de 2016
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
el 13 de Jul. de 2016
YourData(YourData == 0) = nan;
Now call the File Exchange contribution inpaint_nan on YourData.
Categorías
Más información sobre Interpolation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!