From: Alexandra on
HI,

I'm trying to make a smoothing spline through N-dimensional data (with spline toolbox). Something like
spaps({x,y}, f, s)
Everything works fine so far. Now, I have a new set of data points where some values are NaN. Matlab (understandably) doesn't like to build a spline where NaN values are. The non-NaN values are in a self-contained area, but since x and y are only vectors, it is difficult to reshape f to any useful form without NaNs.
Is there any possibility to tell the spline function to take only certain values? Or any other ideas?

Thanks
From: Mark Shore on
"Alexandra " <rueger(a)tum.de> wrote in message <hs966d$o89$1(a)fred.mathworks.com>...
> HI,
>
> I'm trying to make a smoothing spline through N-dimensional data (with spline toolbox). Something like
> spaps({x,y}, f, s)
> Everything works fine so far. Now, I have a new set of data points where some values are NaN. Matlab (understandably) doesn't like to build a spline where NaN values are. The non-NaN values are in a self-contained area, but since x and y are only vectors, it is difficult to reshape f to any useful form without NaNs.
> Is there any possibility to tell the spline function to take only certain values? Or any other ideas?
>
> Thanks

For simple replacement, data(isnan(data))=1 (or whatever numerical value you want) should work.

But look at
http://www.mathworks.com/matlabcentral/fileexchange/4551
http://www.mathworks.com/matlabcentral/fileexchange/21214
From: TideMan on
On May 11, 2:45 am, "Alexandra " <rue...(a)tum.de> wrote:
> HI,
>
> I'm trying to make a smoothing spline through N-dimensional data (with spline toolbox). Something like
> spaps({x,y}, f, s)
> Everything works fine so far. Now, I have a new set of data points where some values are NaN. Matlab (understandably) doesn't like to build a spline where NaN values are.  The non-NaN values are in a self-contained area, but since x and y are only vectors, it is difficult to reshape f to any useful form without NaNs.
> Is there any possibility to tell the spline function to take only certain values? Or any other ideas?
>
> Thanks

Why not simply remove those points from the vectors:
indx=isnan(x) | isnan(y); % Look for NaNs in x or y
% Remove points that have NaN in x or y
x(indx)=[];
y(indx)=[];

From: Alexandra on
TideMan <mulgor(a)gmail.com> wrote in message <a9e9e9b1-7fb6-45cd-bc89-91ad3f58bc56(a)v29g2000prb.googlegroups.com>...
> On May 11, 2:45 am, "Alexandra " <rue...(a)tum.de> wrote:
> > HI,
> >
> > I'm trying to make a smoothing spline through N-dimensional data (with spline toolbox). Something like
> > spaps({x,y}, f, s)
> > Everything works fine so far. Now, I have a new set of data points where some values are NaN. Matlab (understandably) doesn't like to build a spline where NaN values are.  The non-NaN values are in a self-contained area, but since x and y are only vectors, it is difficult to reshape f to any useful form without NaNs.
> > Is there any possibility to tell the spline function to take only certain values? Or any other ideas?
> >
> > Thanks
>
> Why not simply remove those points from the vectors:
> indx=isnan(x) | isnan(y); % Look for NaNs in x or y
> % Remove points that have NaN in x or y
> x(indx)=[];
> y(indx)=[];

Problem is, f is a matrix and if I simply delete a point from my coordinates, there is a whole row of my data missing and not only those which are NaN
From: Alexandra on
"Mark Shore" <mshore(a)magmageosciences.ca> wrote in message <hs985q$72r$1(a)fred.mathworks.com>...
> "Alexandra " <rueger(a)tum.de> wrote in message <hs966d$o89$1(a)fred.mathworks.com>...
> > HI,
> >
> > I'm trying to make a smoothing spline through N-dimensional data (with spline toolbox). Something like
> > spaps({x,y}, f, s)
> > Everything works fine so far. Now, I have a new set of data points where some values are NaN. Matlab (understandably) doesn't like to build a spline where NaN values are. The non-NaN values are in a self-contained area, but since x and y are only vectors, it is difficult to reshape f to any useful form without NaNs.
> > Is there any possibility to tell the spline function to take only certain values? Or any other ideas?
> >
> > Thanks
>
> For simple replacement, data(isnan(data))=1 (or whatever numerical value you want) should work.
>
> But look at
> http://www.mathworks.com/matlabcentral/fileexchange/4551
> http://www.mathworks.com/matlabcentral/fileexchange/21214

Thank you, inpaint_nans is exactly what I need :-)