From: Hydroman S on
My matrix

a = magic(4); a(2,2) = NaN ; a(3,3)=NaN

a =

16 2 3 13
5 NaN 10 8
9 7 NaN 12
4 14 15 1

is missing some data, how do I interpolate missing data
along the columns?

From: John D'Errico on
"Hydroman S" <amirgsalem(a)gmail.com> wrote in message
<fvq09u$59o$1(a)fred.mathworks.com>...
> My matrix
>
> a = magic(4); a(2,2) = NaN ; a(3,3)=NaN
>
> a =
>
> 16 2 3 13
> 5 NaN 10 8
> 9 7 NaN 12
> 4 14 15 1
>
> is missing some data, how do I interpolate missing data
> along the columns?

inpaint nans will interpolate in two
dimensions.

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?
objectId=4551&objectType=file

If you only want to interpolate in one
dimension, then you can most simply loop
over each column, calling inpaint_nans
repeatedly.

Or you could use interp1, but you will
need to do more work, finding the nans
yourself.

John