Possible Duplicate:
MATLAB: Using interpolation to replace missing values (NaN)
I would like to interpolate data in multiple dimensions using the interpn command.
The problem is that the data contains NaN's. Therefore, in some dimensions, there are less than 2 datapoints which prevents matlab from interpolating. I would like interpn to return a NaN value in that case.
EXAMPLE: My data looks somehow likes this
val(:,:,1) =
-2.3810 -0.9365
NaN -0.6910
val(:,:,2) =
-2.3354 -0.9271
NaN -0.6859
Matlab gives an error when interpolating since there are inly NaN's in one dimension. I would like matlab to ignore this error and instead return NaN's form the interpn function.