[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: handling NaN
From: |
Schloegl Alois |
Subject: |
Re: handling NaN |
Date: |
Tue, 06 Aug 2002 05:26:01 +0200 (MEST) |
User-agent: |
IMP/PHP IMAP webmail program 2.2.8 |
| 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');
Alois
-------------------------------------------------------------
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 <=
- 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