the interpolation of a Matrix generated more NaNs elements
Show older comments
I used the following code to perform an interpolation of my matrix , but instead of solving the problem of NaNs entries I have got more because my matrix has got 2 or 3 successive columns of NaNs. Now my question is how to get rid of the NaN s in my matrix without losing data which was available before the interpolation?
[rr,cc] = size(MT);
xi = 1:cc;% columns
idx = ~isnan(MT);
for r = 1:rr
MTNew(r,:) = interp1(xi(idx(r,:)),MT(r,idx(r,:)),xi,'linear','extrap');
end
Thank you !
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation of 2-D Selections in 3-D Grids in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!