[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: handling NaN
From: |
John W. Eaton |
Subject: |
Re: handling NaN |
Date: |
Mon, 5 Aug 2002 22:47:14 -0500 |
On 6-Aug-2002, Schloegl Alois <address@hidden> wrote:
| | Here is how I would solve this problem--one extra line of code, MATLAB
| | compatible too:
| |
| |
| | octave:14> f = [1 2 3 NaN]
| | f =
| |
| | 1 2 3 NaN
| |
| | octave:15> idx = find(~isnan(f));
| | octave:16> max(f(idx))
| | ans = 3
|
| But without using loops, is there also a way to do this along a
| particular dimension of a matrix when each column/row/etc. may have a
| different number of NaNs?
|
| jwe
|
|
| ------------------------------------------------------
|
| John,
|
| I guess this would do it:
|
| f(isnan(f))=-inf;
| max(f);
| max(f');
Right, Paul also pointed out to me in email that the nanmax and
nanmean functions in octave-forge use this method.
Thanks,
jwe
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Re: handling NaN, Schloegl Alois, 2002/08/05
- Re: handling NaN,
John W. Eaton <=
- Re: handling NaN, Schloegl Alois, 2002/08/07
- Re: handling NaN, Paul Kienzle, 2002/08/08
- Re: handling NaN, John W. Eaton, 2002/08/08
- Re: handling NaN, Paul Kienzle, 2002/08/08
- Re: handling NaN, John W. Eaton, 2002/08/08
- Re: handling NaN, John W. Eaton, 2002/08/08
- Re: handling NaN, John W. Eaton, 2002/08/08
- Re: handling NaN, John W. Eaton, 2002/08/08
- Re: handling NaN, Schloegl Alois, 2002/08/13
- Re: handling NaN, Paul Kienzle, 2002/08/13