From help-octave-request at bevo dot che dot wisc dot edu Thu Sep 23 11:56:44 1999 Subject: Re: max() and min() of nan/inf From: "John W. Eaton" To: Mike Miller Cc: Mirek Kwasniak , Olli Saarela , Joao Cardoso , help-octave@bevo.che.wisc.edu Date: Thu, 23 Sep 1999 11:55:34 -0500 (CDT) On 23-Sep-1999, Mike Miller wrote: | A few years ago, when MATLAB was developing their stats toolbox, they | added the functions nansum, nanmean, nanmedian, nanvar, nanstd, nanmax, | nanmin, nancov and nancorr. These functions were identical to sum, mean, | median, var, std, max, min, cov and corrcoef except that they ignored NaNs | in the computations (they do not ignore Inf and -Inf). | Does octave have any of those functions? Not that I know of. Why not just add an optional parameter to min, max, etc. that says to ignore NaNs? Y = min (X, "ignore_nan"); Some questions: * If a vector is all NaNs, should the result be [] or NaN? * If a matrix has a column that is all NaNs, what should the result be for that column? I'd say NaN, since an individual matrix element can't be []. Then for consistency, the answer for the previous question should probably also be NaN. jwe --------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. To ensure that development continues, see www.che.wisc.edu/octave/giftform.html Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html ---------------------------------------------------------------------