Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
BUG in histc !!?

Subject: BUG in histc !!?

From: suresh@alberich.psych.nyu.edu (B. Suresh Krishna)

Date: 4 Oct, 2001 09:36:21

Message: 1 of 11

hi, i have spent the last four hours digging deep into a long bit of code in search of an elusive bug, and finally, it seems to me that i have found something that is wrong with matlab's histc function. in the script below, vect is a monotonically increasing vector, and i am trying to find the point where it crosses some value using histc. the function behaves very curiously, as shown below. is this just some silly error on my part (could be, i havent slept for two days), or is this a real bug ? if it is my error, i just cant see what it is.

thank you very much for your input,

suresh


%***********************BEGIN post.m*****************************

vect = 1.0e-04 * [ 0 0.00000096610799 0.00000579532809 ...
0.00001834549480 0.00004246389464 0.00008198201014 ...
0.00014071028549 0.00022243292082 0.00033090270249 ...
0.00046983587614 0.00064290706979 0.00085374427367 ...
0.00110592388390 0.00140296581651 0.00174832869878 ...
0.00214540514415 0.00259751711746 0.00310791139658 ...
0.00367975513684 0.00431613154422 0.00502003566320 ...
0.00579437028510 0.00664194198237 0.00756545727445 ...
0.00856751893020 0.00965062241215 0.01081715246729 ...
0.01206937986917 0.01340945831564 0.01483942148661 ...
0.01636118026571 0.01797652012973 0.01968709870938 ...
0.02149444352475 0.02339994989843 0.02540487904932 ...
0.02751035636960 0.02971736988730 0.03202676891645 ...
0.03443926289683 0.03695542042475 0.03957566847628 ...
0.04230029182389 0.04512943264746 0.04806309034001 ...
0.05110112150853 0.05424324016989 0.05748901814154 ...
0.06083788562643 0.06428913199152 0.06784190673852 ...
0.07149522066588 0.07524794722013 0.07909882403497 ...
0.08304645465584 0.08708931044767 0.09122573268326 ...
0.09545393480934 0.09977200488727 0.10417790820506 ...
0.10866949005706 0.11324447868767 0.11790048839486 ...
0.12263502278942 0.12744547820543 0.13232914725723 ...
0.13728322253815 0.14230480045582 0.14739088519898 ...
0.15253839283016 0.15774415549885 0.16300492576924 ...
0.16831738105673 0.17367812816709 0.17908370793206 ...
0.18453059993513 0.19001522732096 0.19553396168190 ...
0.20108312801496 0.20665900974242 0.21225785378925 ...
0.21787587571037 0.22350926486082 0.22915418960162 ...
0.23480680253444 0.24046324582748 0.24612063887631 ...
0.25177803192514 0.25743542497397 0.26309281802280 ...
0.26875021107163 0.27440760412046 0.28006499716929 ...
0.28572239021812 0.29137978326696 0.29703717631579 ...
0.30269456936462 0.30835196241345 0.31400935546228 ...
0.31966674851111];


>> %THE ONLY DIFFERENCE IS THAT I USED A LONGER VECTOR THE SECOND
   %TIME
   
>>[ignore,m]=histc(vect(18),[vect(1) vect(1:90)]);
>> m
 
m =
 
    19
 
>> [ignore,m]=histc(vect(18),[vect(1) vect(1:100)]);
>> m
 
m =
 
     1

>> % INCIDENTALLY

>> [ignore,m]=histc(vect(19),[vect(1) vect(1:100)]);
>> m
 
m =
 
    20

>> % WHICH IS CORRECT

-suresh

Subject: BUG in histc !!?

From: Penny Anderson

Date: 4 Oct, 2001 13:32:01

Message: 2 of 11

This has been fixed in R12 (MATLAB 6.0). Sorry for the inconvenience.

Penny Anderson
The MathWorks, Inc.

"B. Suresh Krishna" <suresh@alberich.psych.nyu.edu> wrote in message news:p4Wu7.4$wx4.107@typhoon.nyu.edu...
> hi, i have spent the last four hours digging deep into a long bit of code in search of an elusive bug, and finally, it seems to me
that i have found something that is wrong with matlab's histc function. in the script below, vect is a monotonically increasing
vector, and i am trying to find the point where it crosses some value using histc. the function behaves very curiously, as shown
below. is this just some silly error on my part (could be, i havent slept for two days), or is this a real bug ? if it is my error,
i just cant see what it is.
>
> thank you very much for your input,
>
> suresh
>
>
> %***********************BEGIN post.m*****************************
>
> vect = 1.0e-04 * [ 0 0.00000096610799 0.00000579532809 ...
> 0.00001834549480 0.00004246389464 0.00008198201014 ...
> 0.00014071028549 0.00022243292082 0.00033090270249 ...
> 0.00046983587614 0.00064290706979 0.00085374427367 ...
> 0.00110592388390 0.00140296581651 0.00174832869878 ...
> 0.00214540514415 0.00259751711746 0.00310791139658 ...
> 0.00367975513684 0.00431613154422 0.00502003566320 ...
> 0.00579437028510 0.00664194198237 0.00756545727445 ...
> 0.00856751893020 0.00965062241215 0.01081715246729 ...
> 0.01206937986917 0.01340945831564 0.01483942148661 ...
> 0.01636118026571 0.01797652012973 0.01968709870938 ...
> 0.02149444352475 0.02339994989843 0.02540487904932 ...
> 0.02751035636960 0.02971736988730 0.03202676891645 ...
> 0.03443926289683 0.03695542042475 0.03957566847628 ...
> 0.04230029182389 0.04512943264746 0.04806309034001 ...
> 0.05110112150853 0.05424324016989 0.05748901814154 ...
> 0.06083788562643 0.06428913199152 0.06784190673852 ...
> 0.07149522066588 0.07524794722013 0.07909882403497 ...
> 0.08304645465584 0.08708931044767 0.09122573268326 ...
> 0.09545393480934 0.09977200488727 0.10417790820506 ...
> 0.10866949005706 0.11324447868767 0.11790048839486 ...
> 0.12263502278942 0.12744547820543 0.13232914725723 ...
> 0.13728322253815 0.14230480045582 0.14739088519898 ...
> 0.15253839283016 0.15774415549885 0.16300492576924 ...
> 0.16831738105673 0.17367812816709 0.17908370793206 ...
> 0.18453059993513 0.19001522732096 0.19553396168190 ...
> 0.20108312801496 0.20665900974242 0.21225785378925 ...
> 0.21787587571037 0.22350926486082 0.22915418960162 ...
> 0.23480680253444 0.24046324582748 0.24612063887631 ...
> 0.25177803192514 0.25743542497397 0.26309281802280 ...
> 0.26875021107163 0.27440760412046 0.28006499716929 ...
> 0.28572239021812 0.29137978326696 0.29703717631579 ...
> 0.30269456936462 0.30835196241345 0.31400935546228 ...
> 0.31966674851111];
>
>
> >> %THE ONLY DIFFERENCE IS THAT I USED A LONGER VECTOR THE SECOND
> %TIME
>
> >>[ignore,m]=histc(vect(18),[vect(1) vect(1:90)]);
> >> m
>
> m =
>
> 19
>
> >> [ignore,m]=histc(vect(18),[vect(1) vect(1:100)]);
> >> m
>
> m =
>
> 1
>
> >> % INCIDENTALLY
>
> >> [ignore,m]=histc(vect(19),[vect(1) vect(1:100)]);
> >> m
>
> m =
>
> 20
>
> >> % WHICH IS CORRECT
>
> -suresh

Subject: BUG in histc !!?

From: suresh@alberich.psych.nyu.edu (B. Suresh Krishna)

Date: 6 Oct, 2001 18:33:59

Message: 3 of 11

hi penny,

thanks for the info; but i dont have access to R12, so could you either document the bug further (so i know how to avoid it), or else can i get a copy of the fixed version of histc (assuming it works in 5.3 as well) ?

thanks,

suresh


-suresh

Subject: RANT: Mathworks. handles bugs badly

From: barkingbrown@yahoo.com (Coconut Shell)

Date: 7 Oct, 2001 01:07:27

Message: 4 of 11

Hi, This is a general rant about how Mathworks handles bugs in its
product. A few days ago, I found a bug in Matlab's histc function;
Penny Anderson informed me in a followup that it had been fixed in R12
(I use 5.3). The bug was potentially serious, because it is associated
with the widely-used histc function, and also because I am close to
incorporating the results of my simulations into a published paper. I
am lucky to have found the mistake; because the results were only
slightly off, and I spent many hours trying to track down the source
of the discrepancy, before finally zooming in on the histc function.

However, my point is not that I found a bug; I expect that while using
all software. I am disappointed, concerned, and quite miffed at the
fact that this bug has been known for two years now. It was first
reported in this newsgroup on may 11 1999, and Zhiping You of
Mathworks acknowledged the bug, and suggested that a MEX-file fix
might be placed on the Mathworks site. It was then rediscovered on
August 10 2000, and then again on May 6 2001, but each time, no
Mathworks person responded. But that is not all. On 19 October 2000,
one year after the bug had been acknowledged, I asked a question on
how to perform a zero-crossing operation, and again, Zhiping You
suggested that I use histc (which is how I first found out about this
function). However, there was absolutely no mention of any bug. Note
that this was 1 year after a bug had been found. Since October 2000, I
have been merrily using histc (because it had been recommended as the
fastest solution to my problem), until I had the final joy of
discovering it myself now.

I have some, what I consider obviously justified, wishes and
complaints here.

Shouldnt known bugs be prominently advertised (perhaps on a web page
somewhere) rather than being hidden among newsgroup posts ? In fact,
shouldnt they be advertised on the Mathworks digest (that is emailed
and posted to Access members), so that they are not inadvertently used
by people who dont verify the current accuracy of every function they
use by checking if bugs have been reported ? It is a bit worrying, but
it is hard to estimate how many published histograms are probably
partly or completely wrong because of this error. The estimate is
particularly hard, because no full description of the bug has emerged.
Does the bug affect only histc or does it affect hist as well (this
would be much more serious, because it is commonly used) ? On what
kind of data do histc and hist fail ?

I think these are serious issues that merit some concern.

Thanks, Suresh

ps. Incidentally, I dont have access to MATLAB R12, and so was that
MEX file fix ever placed on the web ?


"Penny Anderson" <penny@mathworks.com> wrote in message news:<9pi6eh$kbn$1@news.mathworks.com>...
> This has been fixed in R12 (MATLAB 6.0). Sorry for the inconvenience.
>
> Penny Anderson
> The MathWorks, Inc.

Subject: Mathworks. handles bugs badly

From: Boyko Stoimenov

Date: 7 Oct, 2001 18:18:11

Message: 5 of 11

Hi Suresh,

What can I say, except that I fully agree with you. I guess someone in the
sales department of TMW has a very 'bright' business model . On one hand if
bugs are made public, everyone will think that Matlab is a buggy product
(which it of course is as much as any other product, maybe just only a bit
more) and wouldn't buy it. On the other hand those that have discovered the
bugs themselves while using the Matlab, must not be provided with free
fixes. They must pay a 'subsciption fee' for those bug fixes and for new
versions (no matter if you want or don't want a new version). I recently had
a similar experience. (You may check 'BUG in Handle Graphics and workaround'
thread on google. ) Because of TMW 'secret bugs' policy I also proposed
in the past to compile a FEB (Frequently Encountered Bugs) list froom the
postings of this NG.
Actually this secrecy about known issues and the overpricing of Matlab and
especially some of the toolboxes (e.g. Excel Link) make me think of
switching to a free clone. Well, maybe not as long as my Lab pays for the
license.
Best,
Boyko


--
On the USENET they seldom misquote you.
 In fact, they usually repeat word for word what you shouldn't have said.
-----------------------------------------------------------
"Coconut Shell" <barkingbrown@yahoo.com> wrote in message
news:238880df.0110070007.29db6d3@posting.google.com...
> Hi, This is a general rant about how Mathworks handles bugs in its
> product. A few days ago, I found a bug in Matlab's histc function;
> Penny Anderson informed me in a followup that it had been fixed in R12
> (I use 5.3). The bug was potentially serious, because it is associated
> with the widely-used histc function, and also because I am close to
> incorporating the results of my simulations into a published paper. I
> am lucky to have found the mistake; because the results were only
> slightly off, and I spent many hours trying to track down the source
> of the discrepancy, before finally zooming in on the histc function.
>
> However, my point is not that I found a bug; I expect that while using
> all software. I am disappointed, concerned, and quite miffed at the
> fact that this bug has been known for two years now. It was first
> reported in this newsgroup on may 11 1999, and Zhiping You of
> Mathworks acknowledged the bug, and suggested that a MEX-file fix
> might be placed on the Mathworks site. It was then rediscovered on
> August 10 2000, and then again on May 6 2001, but each time, no
> Mathworks person responded. But that is not all. On 19 October 2000,
> one year after the bug had been acknowledged, I asked a question on
> how to perform a zero-crossing operation, and again, Zhiping You
> suggested that I use histc (which is how I first found out about this
> function). However, there was absolutely no mention of any bug. Note
> that this was 1 year after a bug had been found. Since October 2000, I
> have been merrily using histc (because it had been recommended as the
> fastest solution to my problem), until I had the final joy of
> discovering it myself now.
>
> I have some, what I consider obviously justified, wishes and
> complaints here.
>
> Shouldnt known bugs be prominently advertised (perhaps on a web page
> somewhere) rather than being hidden among newsgroup posts ? In fact,
> shouldnt they be advertised on the Mathworks digest (that is emailed
> and posted to Access members), so that they are not inadvertently used
> by people who dont verify the current accuracy of every function they
> use by checking if bugs have been reported ? It is a bit worrying, but
> it is hard to estimate how many published histograms are probably
> partly or completely wrong because of this error. The estimate is
> particularly hard, because no full description of the bug has emerged.
> Does the bug affect only histc or does it affect hist as well (this
> would be much more serious, because it is commonly used) ? On what
> kind of data do histc and hist fail ?
>
> I think these are serious issues that merit some concern.
>
> Thanks, Suresh
>
> ps. Incidentally, I dont have access to MATLAB R12, and so was that
> MEX file fix ever placed on the web ?
>
>
> "Penny Anderson" <penny@mathworks.com> wrote in message
news:<9pi6eh$kbn$1@news.mathworks.com>...
> > This has been fixed in R12 (MATLAB 6.0). Sorry for the inconvenience.
> >
> > Penny Anderson
> > The MathWorks, Inc.

Subject: BUG in histc !!?

From: Penny Anderson

Date: 10 Oct, 2001 16:07:16

Message: 6 of 11

Probably part of the problem with the histc bug fix is that it is a MEX-file and it's just a pain to post all 7 or 8 different
MEX-files to the web site for the bug fix.

What platform are you running on? I can try to cook up a MEX-file for you.

Penny Anderson
The MathWorks, Inc.

"B. Suresh Krishna" <suresh@alberich.psych.nyu.edu> wrote in message news:r8Iv7.1$3u6.133@typhoon.nyu.edu...
> hi penny,
>
> thanks for the info; but i dont have access to R12, so could you either document the bug further (so i know how to avoid it), or
else can i get a copy of the fixed version of histc (assuming it works in 5.3 as well) ?
>
> thanks,
>
> suresh
>
>
> -suresh

Subject: BUG in histc !!?

From: Penny Anderson

Date: 10 Oct, 2001 16:08:37

Message: 7 of 11

By the way, it is documented on our web site. A search on histc under the Support tab will turn up mention of it in the MATLAB 6.1
Release Notes. Not much help to you with MATLAB 6.0, I know, but nonetheless, it is still there.

Penny Anderson
The MathWorks, Inc.

"Penny Anderson" <penny@mathworks.com> wrote in message news:9q29pl$ilq$1@news.mathworks.com...
> Probably part of the problem with the histc bug fix is that it is a MEX-file and it's just a pain to post all 7 or 8 different
> MEX-files to the web site for the bug fix.
>
> What platform are you running on? I can try to cook up a MEX-file for you.
>
> Penny Anderson
> The MathWorks, Inc.
>
> "B. Suresh Krishna" <suresh@alberich.psych.nyu.edu> wrote in message news:r8Iv7.1$3u6.133@typhoon.nyu.edu...
> > hi penny,
> >
> > thanks for the info; but i dont have access to R12, so could you either document the bug further (so i know how to avoid it), or
> else can i get a copy of the fixed version of histc (assuming it works in 5.3 as well) ?
> >
> > thanks,
> >
> > suresh
> >
> >
> > -suresh
>
>

Subject: BUG in histc !!?

From: R

Date: 14 Sep, 2013 17:20:07

Message: 8 of 11

Penny Anderson wrote:
quote -- Probably part of the problem with the histc bug fix is that it is a MEX-file and it's just a pain to post all 7 or 8 different MEX-files to the web site for the bug fix. -- end quote

That sounds lame!. How can posting 8 files to a website be more of a pain than the difficulties a bug in a commonly-used function can cause literally thousands of users?. Just read the above examples of what a bug can cause with the valuable time of researchers around the globe!! Let alone the publishing of false results and the possible consequences of that!

The cost of Matlab should be enough to have a dedicated webpage for all known bugs AND their solutions documented so that ANY Matlab user can download the corrected function and use it (I guess some restrictions can happen due to added functionality in newer versions). It is just unfair to make a user buy a new Matlab version (or in my case a new computer to be able to upgrade and then a new Matlab version) just to be able to use a program that was supposed to work reliably from the beginning. Sure bugs are a part of programming and will remain so for the foreseeable future, however, company policy should be much better for the benefit of their customers. Recall Matlab is a company that charges considerable amounts of money for a high-quality product. We are not requesting anything other than what is fair here.

thanks,

Rodrigo Duran.
PhD candidate physical oceanography.

"Penny Anderson" <penny@mathworks.com> wrote in message <9q29pl$ilq$1@news.mathworks.com>...
> Probably part of the problem with the histc bug fix is that it is a MEX-file and it's just a pain to post all 7 or 8 different
> MEX-files to the web site for the bug fix.
>
> What platform are you running on? I can try to cook up a MEX-file for you.
>
> Penny Anderson
> The MathWorks, Inc.
>
> "B. Suresh Krishna" <suresh@alberich.psych.nyu.edu> wrote in message news:r8Iv7.1$3u6.133@typhoon.nyu.edu...
> > hi penny,
> >
> > thanks for the info; but i dont have access to R12, so could you either document the bug further (so i know how to avoid it), or
> else can i get a copy of the fixed version of histc (assuming it works in 5.3 as well) ?
> >
> > thanks,
> >
> > suresh
> >
> >
> > -suresh
>
>

Subject: BUG in histc !!?

From: Penny Anderson

Date: 16 Sep, 2013 13:31:06

Message: 9 of 11

Hi Rodrigo,

Amazing the power of the internet to remember all your youthful utterances, no matter how sensical, or not, they might have been!

Since this post in the Fall of 2001 (12 years ago!) MathWorks has certainly implemented your suggestion. We have a "Bug Report" database available under our Support site. This particular bug from the MATLAB 5.* era, found and fixed so many years ago, is probably not listed. But in the intervening decade we have certainly been diligent about listing the most important bugs, particualrly those in the most frequently used functions. In addition, there are documented workarounds including patches. In this day and age, we would not shy away from patching and posting a MEX-file for all supported platforms, if appropriate.

Good luck with your studies.

Penny Anderson
MathWorks


"R" wrote in message <l125s7$7dt$1@newscl01ah.mathworks.com>...
> Penny Anderson wrote:
> quote -- Probably part of the problem with the histc bug fix is that it is a MEX-file and it's just a pain to post all 7 or 8 different MEX-files to the web site for the bug fix. -- end quote
>
> That sounds lame!. How can posting 8 files to a website be more of a pain than the difficulties a bug in a commonly-used function can cause literally thousands of users?. Just read the above examples of what a bug can cause with the valuable time of researchers around the globe!! Let alone the publishing of false results and the possible consequences of that!
>
> The cost of Matlab should be enough to have a dedicated webpage for all known bugs AND their solutions documented so that ANY Matlab user can download the corrected function and use it (I guess some restrictions can happen due to added functionality in newer versions). It is just unfair to make a user buy a new Matlab version (or in my case a new computer to be able to upgrade and then a new Matlab version) just to be able to use a program that was supposed to work reliably from the beginning. Sure bugs are a part of programming and will remain so for the foreseeable future, however, company policy should be much better for the benefit of their customers. Recall Matlab is a company that charges considerable amounts of money for a high-quality product. We are not requesting anything other than what is fair here.
>
> thanks,
>
> Rodrigo Duran.
> PhD candidate physical oceanography.
>
> "Penny Anderson" <penny@mathworks.com> wrote in message <9q29pl$ilq$1@news.mathworks.com>...
> > Probably part of the problem with the histc bug fix is that it is a MEX-file and it's just a pain to post all 7 or 8 different
> > MEX-files to the web site for the bug fix.
> >
> > What platform are you running on? I can try to cook up a MEX-file for you.
> >
> > Penny Anderson
> > The MathWorks, Inc.
> >
> > "B. Suresh Krishna" <suresh@alberich.psych.nyu.edu> wrote in message news:r8Iv7.1$3u6.133@typhoon.nyu.edu...
> > > hi penny,
> > >
> > > thanks for the info; but i dont have access to R12, so could you either document the bug further (so i know how to avoid it), or
> > else can i get a copy of the fixed version of histc (assuming it works in 5.3 as well) ?
> > >
> > > thanks,
> > >
> > > suresh
> > >
> > >
> > > -suresh
> >
> >

Subject: BUG in histc !!?

From: R

Date: 16 Sep, 2013 16:23:06

Message: 10 of 11

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.)

Thus when I saw this post I thought it was a good time to make a suggestion. I am glad to read my suggestion has been implemented.

Although my suggestion is mainly outdated, perhaps there still is room for improvement however, like making new code available to users of older versions in more cases (like mine).

Thanks again Penny.

Sincerely,

Rodrigo.

"Penny Anderson" <penny.anderson.REMOVE.ME@mathworks.com> wrote in message <l1716q$eg6$1@newscl01ah.mathworks.com>...
> Hi Rodrigo,
>
> Amazing the power of the internet to remember all your youthful utterances, no matter how sensical, or not, they might have been!
>
> Since this post in the Fall of 2001 (12 years ago!) MathWorks has certainly implemented your suggestion. We have a "Bug Report" database available under our Support site. This particular bug from the MATLAB 5.* era, found and fixed so many years ago, is probably not listed. But in the intervening decade we have certainly been diligent about listing the most important bugs, particualrly those in the most frequently used functions. In addition, there are documented workarounds including patches. In this day and age, we would not shy away from patching and posting a MEX-file for all supported platforms, if appropriate.
>
> Good luck with your studies.
>
> Penny Anderson
> MathWorks
>
>
> "R" wrote in message <l125s7$7dt$1@newscl01ah.mathworks.com>...
> > Penny Anderson wrote:
> > quote -- Probably part of the problem with the histc bug fix is that it is a MEX-file and it's just a pain to post all 7 or 8 different MEX-files to the web site for the bug fix. -- end quote
> >
> > That sounds lame!. How can posting 8 files to a website be more of a pain than the difficulties a bug in a commonly-used function can cause literally thousands of users?. Just read the above examples of what a bug can cause with the valuable time of researchers around the globe!! Let alone the publishing of false results and the possible consequences of that!
> >
> > The cost of Matlab should be enough to have a dedicated webpage for all known bugs AND their solutions documented so that ANY Matlab user can download the corrected function and use it (I guess some restrictions can happen due to added functionality in newer versions). It is just unfair to make a user buy a new Matlab version (or in my case a new computer to be able to upgrade and then a new Matlab version) just to be able to use a program that was supposed to work reliably from the beginning. Sure bugs are a part of programming and will remain so for the foreseeable future, however, company policy should be much better for the benefit of their customers. Recall Matlab is a company that charges considerable amounts of money for a high-quality product. We are not requesting anything other than what is fair here.
> >
> > thanks,
> >
> > Rodrigo Duran.
> > PhD candidate physical oceanography.
> >
> > "Penny Anderson" <penny@mathworks.com> wrote in message <9q29pl$ilq$1@news.mathworks.com>...
> > > Probably part of the problem with the histc bug fix is that it is a MEX-file and it's just a pain to post all 7 or 8 different
> > > MEX-files to the web site for the bug fix.
> > >
> > > What platform are you running on? I can try to cook up a MEX-file for you.
> > >
> > > Penny Anderson
> > > The MathWorks, Inc.
> > >
> > > "B. Suresh Krishna" <suresh@alberich.psych.nyu.edu> wrote in message news:r8Iv7.1$3u6.133@typhoon.nyu.edu...
> > > > hi penny,
> > > >
> > > > thanks for the info; but i dont have access to R12, so could you either document the bug further (so i know how to avoid it), or
> > > else can i get a copy of the fixed version of histc (assuming it works in 5.3 as well) ?
> > > >
> > > > thanks,
> > > >
> > > > suresh
> > > >
> > > >
> > > > -suresh
> > >
> > >

Subject: BUG in histc !!?

From: Steven_Lord

Date: 16 Sep, 2013 18:05:34

Message: 11 of 11



"R " <yaelds@yahoo.com> wrote in message
news:l17b9a$col$1@newscl01ah.mathworks.com...
> 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.)

*snip*

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)

*snip*

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us