octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hist with nan's


From: Jordi Gutiérrez Hermoso
Subject: Re: hist with nan's
Date: Wed, 9 May 2012 15:51:40 -0400

On 9 May 2012 14:26, Muhali <address@hidden> wrote:
> For hist (Y, X, NORM), octave normalizes relative to the number of rows in Y.
> Since hist understands nan's, it would be more logical so normalize relative
> to the non-nan's of Y. The appropriate patch is attached.
>
> M.
>
> --- hist.m      2012-05-09 11:11:55.840231862 -0700
> +++ /tmp/hist.m 2012-05-09 11:11:25.924878643 -0700
> @@ -149,7 +149,8 @@
>   if (nargin > 2 && ! ischar (varargin{iarg}))
>     ## Normalise the histogram.
>     norm = varargin{iarg++};
> -    freq = freq / rows (y) * norm;
> +    # freq = freq / rows (y) * norm;
> +    freq = freq / sum (!isnan(y)) * norm;
>   endif
>
>   if (nargout > 0)

This makes sense. Thanks for the patch. How do you want to be
credited? Usually we do "Full Name <address@hidden>", but if you want
to go by another name or a pseudonym, that's fine.

- Jordi G. H.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]