The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: BUG in histc !!?
Replies: 5   Last Post: Sep 16, 2013 2:05 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: BUG in histc !!?
Posted: Sep 16, 2013 2:05 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"R " <> wrote in message
> Hi Penny,
> Thank you for your answer. It was my mistake to not see the date of the
> email, indeed an old thread. However, I did encounter a recent situation
> (last few months) where I was unable to update to a more recent version of
> Matlab (because the Apple computer could not in turn update to a newer
> OS). The result is that I am now stuck with a Matlab version that cannot
> run TriScatteredInterp on my data because of a bug -- something about not
> being able to handle NaNs. I did contact customer support and they
> mentioned there was no fix for this other than upgrading my Matlab version
> which I can't. (Well they did suggest using zeros or some other
> place-holder but interpolating a zero value is not the same as ignoring a
> NaN value. I could use a ridiculously high value so I can reject high
> values in the interpolated field, but I would be loosing data that way. I
> would rather interpolate from the good values while ignoring the NaN
> ones.)


I'll let Penny address your suggestion about backporting and focus on
handling NaN values in the data (not coordinates) used by
TriScatteredInterp. You said that you would "rather interpolate from the
good values while ignoring the NaN ones." If the NaNs are in the data inputs
to TriScatteredInterp and not the coordinate inputs, an easy way to do that
is using a mask:

x = rand(100,1)*4-2;
y = rand(100,1)*4-2;
z = x.*exp(-x.^2-y.^2);

% Introduce a NaN
zz = z; zz(1) = NaN;

% Create the mask
finiteonly = isfinite(zz);

% Use just the "good" data
F = TriScatteredInterp(x(finiteonly), y(finiteonly), zz(finiteonly));

% Check and see how it did
differenceShouldBeSmall = F(x(1), y(1)) - z(1)


Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.