Wednesday, 15 June 2011

matlab - How do you change NaNs to the closest number, either above or below -



matlab - How do you change NaNs to the closest number, either above or below -

i have 4x5 matrix, have nans mixed in value. alter nans nearest number, either above or below (because each column disconnected next), so:

a= nan 10 35 150 1.5 4.2 11 nan 149 1.45 4.8 nan 36.1 153 1.3 5.3 13 40 147 nan

i have function alter matrix to:

b= 4.2 10 35 150 1.5 4.2 11 35 149 1.45 4.8 11 36.1 153 1.3 5.3 13 40 147 1.3

i think utilize sort of interpolation this, im not exclusively sure how.

in senario able hand using matrixes 1000sx1000s couldn't then! have looked other examples of how this, lot of them alter nans zeros.

thanks in advance help.

jordan

use inpaint_nans, wonderful tool john d'errico interpolate nan elements in 2-d array using non-nan elements. can extrapolate, not utilize triangulation of data. offers several approaches interpolation, give tradeoffs in accuracy versus speed , memory required.

matlab matrix interpolation nan

No comments:

Post a Comment