Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: repace NaN with zero
Date: Tue, 16 Jun 2009 03:20:18 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 21
Message-ID: <h1731i$pue$1@fred.mathworks.com>
References: <h171ga$inm$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1245122418 26574 172.30.248.35 (16 Jun 2009 03:20:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 16 Jun 2009 03:20:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1875128
Xref: news.mathworks.com comp.soft-sys.matlab:547764


OK I got it
k = find(isnan(A))';
A(k) = 0;

Diego


"Diego Lass" <dlISCool@gmail.com> wrote in message <h171ga$inm$1@fred.mathworks.com>...
> Hi
> I want to replace NaN in the current matrix with 0, what is the fastest way? 
>  
> A = [ 1 2 NaN; NaN 2 3; NaN NaN 100 ]
> 
> A =
> 
>      1     2   NaN
>    NaN     2     3
>    NaN   NaN   100
> 
> Thanks
> Diego